Debian Codegraph @

lib/3rdParty/composer/symfony/clock/Resources/now.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Clock;
13
14 if (!\function_exists(now::class)) {
15 /**
16 * @throws \DateMalformedStringException When the modifier is invalid
17 */
18 function now(string $modifier = 'now'): DatePoint
19 {
20 if ('now' !== $modifier) {
21 return new DatePoint($modifier);
22 }
23
24 $now = Clock::get()->now();
25
26 return $now instanceof DatePoint ? $now : DatePoint::createFromInterface($now);
27 }
28 }