コード例 #1
0
ファイル: Nano.php プロジェクト: techworker/nano
 /**
  * Magic call method to provide a "default" method instead of the "def". Usage looks nicer for me.
  *
  * @param string $name The name of the function to call.
  * @param array $arguments The arguments of the call.
  * @return mixed
  * @throws \InvalidArgumentException
  * @throws \Exception
  */
 public function __call($name, $arguments)
 {
     // check args
     if (!isset($arguments[0]) || !is_string($arguments[0])) {
         throw new \InvalidArgumentException("Missing argument 1 for Nano::default() method call.");
     }
     // check method name
     if ($name === "default") {
         // call internal default method
         return $this->def($arguments[0]);
     }
     // we dont have this method.
     throw new \BadMethodCallException(Nano::tpl("Unknown method call {name} or f****d up arguments", array('name' => $name)));
 }