/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/chronos/src/Traits
NameSizeModeActions
ComparisonTrait.php161920644editdlrm
CopyTrait.php9220644editdlrm
DifferenceTrait.php127050644editdlrm
FactoryTrait.php137630644editdlrm
FormattingTrait.php59580644editdlrm
FrozenTimeTrait.php66390644editdlrm
MagicPropertyTrait.php41790644editdlrm
ModifierTrait.php371650644editdlrm
RelativeKeywordTrait.php26510644editdlrm
TestingAidTrait.php18260644editdlrm
TimezoneTrait.php20580644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/chronos/src/Traits/FrozenTimeTrait.php (6639B)
format('Y-m-d 00:00:00'); } /** * Remove time components from strtotime relative strings. * * @param string $time The input expression * @return string The output expression with no time modifiers. */ protected function stripRelativeTime(string $time): string { return preg_replace('/([-+]\s*\d+\s(?:minutes|seconds|hours|microseconds))/', '', $time); } /** * Modify the time on the Date. * * This method ignores all inputs and forces all inputs to 0. * * @param int $hours The hours to set (ignored) * @param int $minutes The minutes to set (ignored) * @param int $seconds The seconds to set (ignored) * @param int $microseconds The microseconds to set (ignored) * @return static A modified Date instance. */ #[ReturnTypeWillChange] public function setTime($hours, $minutes, $seconds = null, $microseconds = null): ChronosInterface { return parent::setTime(0, 0, 0, 0); } /** * Add an Interval to a Date * * Any changes to the time will be ignored and reset to 00:00:00 * * @param \DateInterval $interval The interval to modify this date by. * @return static A modified Date instance */ #[ReturnTypeWillChange] public function add($interval): ChronosInterface { return parent::add($interval)->setTime(0, 0, 0); } /** * Subtract an Interval from a Date. * * Any changes to the time will be ignored and reset to 00:00:00 * * @param \DateInterval $interval The interval to modify this date by. * @return static A modified Date instance */ #[ReturnTypeWillChange] public function sub($interval): ChronosInterface { return parent::sub($interval)->setTime(0, 0, 0); } /** * No-op method. * * Timezones have no effect on calendar dates. * * @param \DateTimeZone|string $value The DateTimeZone object or timezone name to use. * @return $this */ public function timezone($value) { if (static::class === ChronosDate::class) { trigger_error('2.5 timezone() will be removed in 3.x.', E_USER_DEPRECATED); } return $this; } /** * No-op method. * * Timezones have no effect on calendar dates. * * @param \DateTimeZone|string $value The DateTimeZone object or timezone name to use. * @return $this */ public function tz($value) { if (static::class === ChronosDate::class) { trigger_error('2.5 tz() will be removed in 3.x.', E_USER_DEPRECATED); } return $this; } /** * No-op method. * * Timezones have no effect on calendar dates. * * @param \DateTimeZone|string $value The DateTimeZone object or timezone name to use. * @return $this */ #[ReturnTypeWillChange] public function setTimezone($value) { if (static::class === ChronosDate::class) { $trace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 5); $found = false; foreach ($trace as $frame) { $found = in_array( $frame['class'], ['PHPUnit\Framework\Assert', 'PHPUnit\Framework\Constraint\IsEqual'], true ); if ($found) { break; } } if (!$found) { trigger_error('2.5 setTimezone() will be removed in 3.x.', E_USER_DEPRECATED); } } return $this; } /** * Set the timestamp value and get a new object back. * * This method will discard the time aspects of the timestamp * and only apply the date portions * * @param int $value The timestamp value to set. * @return static */ #[ReturnTypeWillChange] public function setTimestamp($value): ChronosInterface { if (static::class === ChronosDate::class) { trigger_error('2.5 setTimestamp() will be removed in 3.x.', E_USER_DEPRECATED); } return parent::setTimestamp($value)->setTime(0, 0, 0); } /** * Overloaded to ignore time changes. * * Changing any aspect of the time will be ignored, and the resulting object * will have its time frozen to 00:00:00. * * @param string $relative The relative change to make. * @return static A new date with the applied date changes. */ #[ReturnTypeWillChange] public function modify($relative): ChronosInterface { if (preg_match('/hour|minute|second/', $relative)) { return $this; } $new = parent::modify($relative); if ($new->format('H:i:s') !== '00:00:00') { return $new->setTime(0, 0, 0); } return $new; } }