File "Cast.php"
Full Path: /home/warrior1/public_html/wp-content/plugins/mailpoet/vendor-prefixed/nesbot/carbon/src/Carbon/Traits/Cast.php
File size: 556 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace MailPoetVendor\Carbon\Traits;
if (!defined('ABSPATH')) exit;
use MailPoetVendor\Carbon\Exceptions\InvalidCastException;
use DateTimeInterface;
trait Cast
{
public function cast(string $className)
{
if (!\method_exists($className, 'instance')) {
if (\is_a($className, DateTimeInterface::class, \true)) {
return new $className($this->rawFormat('Y-m-d H:i:s.u'), $this->getTimezone());
}
throw new InvalidCastException("{$className} has not the instance() method needed to cast the date.");
}
return $className::instance($this);
}
}