function DateTimePlus::__callStatic

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Datetime/DateTimePlus.php \Drupal\Component\Datetime\DateTimePlus::__callStatic()
  2. 10 core/lib/Drupal/Component/Datetime/DateTimePlus.php \Drupal\Component\Datetime\DateTimePlus::__callStatic()
  3. 11.x core/lib/Drupal/Component/Datetime/DateTimePlus.php \Drupal\Component\Datetime\DateTimePlus::__callStatic()

Implements the magic __callStatic method.

Passes through all unknown static calls onto the DateTime object.

File

core/lib/Drupal/Component/Datetime/DateTimePlus.php, line 394

Class

DateTimePlus
Wraps DateTime().

Namespace

Drupal\Component\Datetime

Code

public static function __callStatic($method, $args) {
    if (!method_exists('\\DateTime', $method)) {
        throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
    }
    return call_user_func_array([
        '\\DateTime',
        $method,
    ], $args);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.