Skip to content

Commit

Permalink
Rename ChronosTime::parseTime() to avoid conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
othercorey committed Apr 27, 2023
1 parent d26e6bb commit b79b62f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ChronosTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ public function __construct(
if ($timezone !== null) {
$time = $time->setTimezone($timezone);
}
$this->ticks = static::parseTime($time->format('H:i:s.u'));
$this->ticks = static::parseString($time->format('H:i:s.u'));
} elseif (is_string($time)) {
$this->ticks = static::parseTime($time);
$this->ticks = static::parseString($time);
} elseif ($time instanceof ChronosTime) {
$this->ticks = $time->ticks;
} else {
$this->ticks = static::parseTime($time->format('H:i:s.u'));
$this->ticks = static::parseString($time->format('H:i:s.u'));
}
}

Expand All @@ -102,7 +102,7 @@ public static function parse(
* @param string $time Time string in the format HH[:.]mm or HH[:.]mm[:.]ss.u
* @return int
*/
protected static function parseTime(string $time): int
protected static function parseString(string $time): int
{
if (!preg_match('/^\s*(\d{1,2})[:.](\d{1,2})(?|[:.](\d{1,2})[.](\d+)|[:.](\d{1,2}))?\s*$/', $time, $matches)) {
throw new InvalidArgumentException(
Expand Down

0 comments on commit b79b62f

Please sign in to comment.