1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
\xampp\htdocs\CSM\vendor\nesbot\carbon\src\Carbon\Carbon.php
*
* @throws \InvalidArgumentException
*
* @return static
*/
public static function createFromFormat($format, $time, $tz = null)
{
if ($tz !== null) {
$dt = parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz));
} else {
$dt = parent::createFromFormat($format, $time);
}
static::setLastErrors($lastErrors = parent::getLastErrors());
if ($dt instanceof DateTime) {
return static::instance($dt);
}
throw new InvalidArgumentException(implode(PHP_EOL, $lastErrors['errors']));
}
/**
* Set last errors.
*
* @param array $lastErrors
*
* @return void
*/
private static function setLastErrors(array $lastErrors)
{
static::$lastErrors = $lastErrors;
}
/**
* {@inheritdoc}
*/
public static function getLastErrors()
{
return static::$lastErrors; |
Partager