__call() 공개 메소드

public __call ( string $name, array $arguments ) : mixed | void
$name string
$arguments array
리턴 mixed | void
예제 #1
0
 public function __call($name, array $arguments)
 {
     if (preg_match('#^(' . implode('|', static::$magicMethodsPrefixes) . ')(.+)$#', $name, $matches)) {
         if (count($arguments) !== 1) {
             throw new InvalidMethodCallException(get_called_class() . "::{$name} expects exactly 1 argument. " . count($arguments) . ' given.');
         }
         list($query) = $arguments;
         if (!$query instanceof IQuery) {
             throw new InvalidArgumentException('Argument 1 passed to ' . get_called_class() . "::{$name} must implement interface Inlm\\QueryObject\\IQuery. " . gettype($query) . ' given.');
         }
         list(, $method, $field) = $matches;
         $field = lcfirst($field);
         return $this->{$method}($field, $query);
     } else {
         return parent::__call($name, $arguments);
     }
 }