Esempio n. 1
0
 /**
  * Magic method for anything called that doesn't exist
  *
  * @param string $requested_method
  * @param array  $arguments
  *
  * List of many of the possible method being called here
  * documented at the top of this class.
  */
 public function __call($requested_method, $arguments)
 {
     // Convert to snake case
     $name = strtolower(preg_replace('/(.)([A-Z])/', '$1_$2', $requested_method));
     // The first argument is the string|array|object we want to echo out
     $output = reset($arguments);
     $name = $this->applyStyleMethods($name);
     // If we have fulfilled all of the requested methods and we have output, output it
     if (!strlen($name) && $this->hasOutput($output)) {
         return $this->out($output);
     }
     // If we still have something left, let's see if it's a terminal object
     if (strlen($name)) {
         if ($this->terminal_object->exists($name)) {
             // Retrieve the parser for the current set of styles
             $parser = $this->style->parser();
             // Reset the styles
             $this->style->reset();
             // Execute the terminal object
             $obj = $this->terminal_object->settings($this->settings)->parser($parser)->execute($name, $arguments);
             // If something was returned, return it
             if ($obj) {
                 return $obj;
             }
         } elseif ($this->settings->exists($name)) {
             $this->settings->add($name, $output);
         } else {
             // If we can't find it at this point, let's fail gracefully
             return $this->out($output);
         }
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * Route anything leftover after styles were applied
  *
  * @param string $name
  * @param array $arguments
  *
  * @return object|null
  */
 protected function routeRemainingMethod($name, array $arguments)
 {
     // If we still have something left, let's figure out what it is
     if ($this->router->exists($name)) {
         $obj = $this->buildTerminalObject($name, $arguments);
         // If something was returned, return it
         if (is_object($obj)) {
             return $obj;
         }
     } elseif ($this->settings->exists($name)) {
         $this->settings->add($name, reset($arguments));
         // Handle passthroughs to the arguments manager.
     } else {
         // If we can't find it at this point, let's fail gracefully
         $this->out(reset($arguments));
     }
 }