Beispiel #1
0
 /**
  * Magic method for anything called that doesn't exist
  *
  * @param string $requested_method
  * @param array  $arguments
  *
  * @return \League\CLImate\CLImate|\League\CLImate\TerminalObject\Dynamic\DynamicTerminalObject
  *
  * List of many of the possible method being called here
  * documented at the top of this class.
  */
 public function __call($requested_method, $arguments)
 {
     // Apply any style methods that we can find first
     $name = $this->applyStyleMethods(Helper::snakeCase($requested_method));
     // The first argument is the string|array|object we want to echo out
     $output = reset($arguments);
     if (strlen($name)) {
         // If we have something left, let's try and route it to the appropriate place
         if ($result = $this->routeRemainingMethod($name, $arguments)) {
             return $result;
         }
     } elseif ($this->hasOutput($output)) {
         // If we have fulfilled all of the requested methods and we have output, output it
         $this->out($output);
     }
     return $this;
 }
 /**
  * Determine the extension key based on the class
  *
  * @param string|null $key
  * @param string|object $class
  *
  * @return string
  */
 protected function getKey($key, $class)
 {
     if ($key === null || !is_string($key)) {
         $class_path = is_string($class) ? $class : get_class($class);
         $key = explode('\\', $class_path);
         $key = end($key);
     }
     return Helper::snakeCase($key);
 }