Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 1 addition & 217 deletions src/Chronos.php

Large diffs are not rendered by default.

133 changes: 1 addition & 132 deletions src/ChronosDate.php

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions src/ChronosDatePeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,34 @@
*/
protected Iterator $iterator;

/**
* @param \DatePeriod $period
*/
public function __construct(DatePeriod $period)

Check failure on line 34 in src/ChronosDatePeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function __construct()
{
/** @var \Iterator<int, \DateTimeInterface> $iterator */
$iterator = $period->getIterator();
$this->iterator = $iterator;
}

/**
* @return \Cake\Chronos\ChronosDate
*/
public function current(): ChronosDate

Check failure on line 41 in src/ChronosDatePeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function current()
{
return new ChronosDate($this->iterator->current());
}

/**
* @return int
*/
public function key(): int

Check failure on line 46 in src/ChronosDatePeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function key()
{
return $this->iterator->key();
}

/**
* @return void
*/
public function next(): void

Check failure on line 51 in src/ChronosDatePeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function next()
{
$this->iterator->next();
}

/**
* @return void
*/
public function rewind(): void

Check failure on line 56 in src/ChronosDatePeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function rewind()
{
$this->iterator->rewind();
}

/**
* @return bool
*/
public function valid(): bool

Check failure on line 61 in src/ChronosDatePeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function valid()
{
return $this->iterator->valid();
}
Expand Down
18 changes: 0 additions & 18 deletions src/ChronosPeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,33 @@
*/
protected Iterator $iterator;

/**
* @param \DatePeriod $period
*/
public function __construct(DatePeriod $period)

Check failure on line 34 in src/ChronosPeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function __construct()
{
/** @var \Iterator<int, \DateTimeInterface> $iterator */
$iterator = $period->getIterator();
$this->iterator = $iterator;
}

/**
* @return \Cake\Chronos\Chronos
*/
public function current(): Chronos

Check failure on line 41 in src/ChronosPeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function current()
{
return new Chronos($this->iterator->current());
}

/**
* @return int
*/
public function key(): int

Check failure on line 46 in src/ChronosPeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function key()
{
return $this->iterator->key();
}

/**
* @return void
*/
public function next(): void

Check failure on line 51 in src/ChronosPeriod.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Missing doc comment for function next()
{
$this->iterator->next();
}

/**
* @return void
*/
public function rewind(): void
{
$this->iterator->rewind();
}

/**
* @return bool
*/
public function valid(): bool
{
return $this->iterator->valid();
Expand Down
41 changes: 0 additions & 41 deletions src/ChronosTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,9 @@ class ChronosTime implements Stringable

/**
* Format to use for __toString method.
*
* @var string
*/
protected static string $toStringFormat = self::DEFAULT_TO_STRING_FORMAT;

/**
* @var int
*/
protected int $ticks;

/**
Expand Down Expand Up @@ -103,7 +98,6 @@ public function __construct(
*
* @param \Cake\Chronos\ChronosTime|\DateTimeInterface|string $time Time
* @param \DateTimeZone|string|null $timezone The timezone to use for now
* @return static
*/
public static function parse(
ChronosTime|DateTimeInterface|string|null $time = null,
Expand All @@ -114,7 +108,6 @@ public static function parse(

/**
* @param string $time Time string in the format HH[:.]mm or HH[:.]mm[:.]ss.u
* @return int
*/
protected static function parseString(string $time): int
{
Expand Down Expand Up @@ -145,7 +138,6 @@ protected static function parseString(string $time): int
* Returns instance set to server time.
*
* @param \DateTimeZone|string|null $timezone The timezone to use for now
* @return static
*/
public static function now(DateTimeZone|string|null $timezone = null): static
{
Expand All @@ -154,8 +146,6 @@ public static function now(DateTimeZone|string|null $timezone = null): static

/**
* Returns instance set to midnight.
*
* @return static
*/
public static function midnight(): static
{
Expand All @@ -164,8 +154,6 @@ public static function midnight(): static

/**
* Returns instance set to noon.
*
* @return static
*/
public static function noon(): static
{
Expand All @@ -177,7 +165,6 @@ public static function noon(): static
* 23:59:59 or 23:59:59.999999 if `$microseconds` is true
*
* @param bool $microseconds Whether to set microseconds or not
* @return static
*/
public static function endOfDay(bool $microseconds = false): static
{
Expand All @@ -190,8 +177,6 @@ public static function endOfDay(bool $microseconds = false): static

/**
* Returns clock microseconds.
*
* @return int
*/
public function getMicroseconds(): int
{
Expand All @@ -202,7 +187,6 @@ public function getMicroseconds(): int
* Sets clock microseconds.
*
* @param int $microseconds Clock microseconds
* @return static
*/
public function setMicroseconds(int $microseconds): static
{
Expand All @@ -217,8 +201,6 @@ public function setMicroseconds(int $microseconds): static

/**
* Return clock seconds.
*
* @return int
*/
public function getSeconds(): int
{
Expand All @@ -231,7 +213,6 @@ public function getSeconds(): int
* Set clock seconds.
*
* @param int $seconds Clock seconds
* @return static
*/
public function setSeconds(int $seconds): static
{
Expand All @@ -246,8 +227,6 @@ public function setSeconds(int $seconds): static

/**
* Returns clock minutes.
*
* @return int
*/
public function getMinutes(): int
{
Expand All @@ -260,7 +239,6 @@ public function getMinutes(): int
* Set clock minutes.
*
* @param int $minutes Clock minutes
* @return static
*/
public function setMinutes(int $minutes): static
{
Expand All @@ -275,8 +253,6 @@ public function setMinutes(int $minutes): static

/**
* Returns clock hours.
*
* @return int
*/
public function getHours(): int
{
Expand All @@ -289,7 +265,6 @@ public function getHours(): int
* Set clock hours.
*
* @param int $hours Clock hours
* @return static
*/
public function setHours(int $hours): static
{
Expand All @@ -309,7 +284,6 @@ public function setHours(int $hours): static
* @param int $minutes Clock minutes
* @param int $seconds Clock seconds
* @param int $microseconds Clock microseconds
* @return static
*/
public function setTime(int $hours = 0, int $minutes = 0, int $seconds = 0, int $microseconds = 0): static
{
Expand All @@ -328,7 +302,6 @@ public function setTime(int $hours = 0, int $minutes = 0, int $seconds = 0, int
/**
* @param int $a Left side
* @param int $a Right side
* @return int
*/
protected static function mod(int $a, int $b): int
{
Expand All @@ -346,7 +319,6 @@ protected static function mod(int $a, int $b): int
* will still be interpreted. Be sure to escape those characters first.
*
* @param string $format Format string
* @return string
*/
public function format(string $format): string
{
Expand All @@ -355,8 +327,6 @@ public function format(string $format): string

/**
* Reset the format used to the default when converting to a string
*
* @return void
*/
public static function resetToStringFormat(): void
{
Expand All @@ -367,7 +337,6 @@ public static function resetToStringFormat(): void
* Set the default format used when converting to a string
*
* @param string $format The format to use in future __toString() calls.
* @return void
*/
public static function setToStringFormat(string $format): void
{
Expand All @@ -376,8 +345,6 @@ public static function setToStringFormat(string $format): void

/**
* Format the instance as a string using the set format
*
* @return string
*/
public function __toString(): string
{
Expand All @@ -388,7 +355,6 @@ public function __toString(): string
* Returns whether time is equal to target time.
*
* @param \Cake\Chronos\ChronosTime $target Target time
* @return bool
*/
public function equals(ChronosTime $target): bool
{
Expand All @@ -399,7 +365,6 @@ public function equals(ChronosTime $target): bool
* Returns whether time is greater than target time.
*
* @param \Cake\Chronos\ChronosTime $target Target time
* @return bool
*/
public function greaterThan(ChronosTime $target): bool
{
Expand All @@ -410,7 +375,6 @@ public function greaterThan(ChronosTime $target): bool
* Returns whether time is greater than or equal to target time.
*
* @param \Cake\Chronos\ChronosTime $target Target time
* @return bool
*/
public function greaterThanOrEquals(ChronosTime $target): bool
{
Expand All @@ -421,7 +385,6 @@ public function greaterThanOrEquals(ChronosTime $target): bool
* Returns whether time is less than target time.
*
* @param \Cake\Chronos\ChronosTime $target Target time
* @return bool
*/
public function lessThan(ChronosTime $target): bool
{
Expand All @@ -432,7 +395,6 @@ public function lessThan(ChronosTime $target): bool
* Returns whether time is less than or equal to target time.
*
* @param \Cake\Chronos\ChronosTime $target Target time
* @return bool
*/
public function lessThanOrEquals(ChronosTime $target): bool
{
Expand All @@ -445,7 +407,6 @@ public function lessThanOrEquals(ChronosTime $target): bool
* @param \Cake\Chronos\ChronosTime $start Start of target range
* @param \Cake\Chronos\ChronosTime $end End of target range
* @param bool $equals Whether to include the beginning and end of range
* @return bool
*/
public function between(ChronosTime $start, ChronosTime $end, bool $equals = true): bool
{
Expand All @@ -464,7 +425,6 @@ public function between(ChronosTime $start, ChronosTime $end, bool $equals = tru
* Returns an `DateTimeImmutable` instance set to this clock time.
*
* @param \DateTimeZone|string|null $timezone Time zone the DateTimeImmutable instance will be in
* @return \DateTimeImmutable
*/
public function toDateTimeImmutable(DateTimeZone|string|null $timezone = null): DateTimeImmutable
{
Expand All @@ -484,7 +444,6 @@ public function toDateTimeImmutable(DateTimeZone|string|null $timezone = null):
* Alias of `toDateTimeImmutable()`.
*
* @param \DateTimeZone|string|null $timezone Time zone the DateTimeImmutable instance will be in
* @return \DateTimeImmutable
*/
public function toNative(DateTimeZone|string|null $timezone = null): DateTimeImmutable
{
Expand Down
2 changes: 0 additions & 2 deletions src/DifferenceFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class DifferenceFormatter implements DifferenceFormatterInterface
{
/**
* The text translator object
*
* @var \Cake\Chronos\Translator
*/
protected Translator $translate;

Expand Down
Loading