HtmlObject\Traits\Tag::__call PHP Method

__call() public method

Dynamically set attributes.
public __call ( string $method, array $parameters )
$method string An attribute
$parameters array Its value(s)
    public function __call($method, $parameters)
    {
        // Replace underscores
        $method = Helpers::hyphenated($method);
        $method = str_replace('_', '-', $method);
        // Get value and set it
        $value = Helpers::arrayGet($parameters, 0, true);
        $this->{$method} = $value;
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Delegate methods to the Imagine instance
  *
  * @param  string $method
  * @param  array $arguments
  *
  * @return Image
  */
 public function __call($method, $arguments)
 {
     if (method_exists('Imagine\\Gd\\Image', $method)) {
         $this->salts[$method] = $arguments;
     }
     return parent::__call($method, $arguments);
 }