DateTimePlus::__call

public DateTimePlus::__call($method, $args)

Implements the magic __call method.

Passes through all unknown calls onto the DateTime object.

File

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

Class

DateTimePlus
Wraps DateTime().

Namespace

Drupal\Component\Datetime

Code

public function __call($method, $args) {
  // @todo consider using assert() as per https://www.drupal.org/node/2451793.
  if (!isset($this->dateTimeObject)) {
    throw new \Exception('DateTime object not set.');
  }
  if (!method_exists($this->dateTimeObject, $method)) {
    throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  }
  return call_user_func_array(array($this->dateTimeObject, $method), $args);
}
doc_Drupal
2016-10-29 09:01:04
Comments
Leave a Comment

Please login to continue.