/**
  * @param string $key
  * @param Tag    $tag
  *
  * @throws InvalidTagException if the passed $value is not a Tag
  */
 public function set($key, $tag)
 {
     if ($tag instanceof Tag) {
         throw InvalidTagException::build([], ['invalidTag' => $tag]);
     }
     parent::set($key, $tag);
 }
Beispiel #2
0
 /**
  * Set cookie
  *
  * The second argument may be a single scalar value, in which case
  * it will be merged with the default settings and considered the `value`
  * of the merged result.
  *
  * The second argument may also be an array containing any or all of
  * the keys shown in the default settings above. This array will be
  * merged with the defaults shown above.
  *
  * @param string $key   Cookie name
  * @param mixed  $value Cookie settings
  */
 public function set($key, $value)
 {
     if (is_array($value)) {
         $cookieSettings = array_replace($this->defaults, $value);
     } else {
         $cookieSettings = array_replace($this->defaults, array('value' => $value));
     }
     parent::set($key, $cookieSettings);
 }
Beispiel #3
0
 /**
  * DEPRECATION WARNING! This method will be removed in the next major point release
  *
  * Set data for view
  */
 public function setData()
 {
     $args = func_get_args();
     if (count($args) === 1 && is_array($args[0])) {
         $this->data->replace($args[0]);
     } elseif (count($args) === 2) {
         $this->data->set($args[0], $args[1]);
     } else {
         throw new \InvalidArgumentException('Cannot set View data with provided arguments. Usage: `View::setData( $key, $value );` or `View::setData([ key => value, ... ]);`');
     }
 }
Beispiel #4
0
 /**
  * DEPRECATION WARNING! This method will be removed in the next major point release
  *
  * Set data for view
  */
 public function setData()
 {
     $args = func_get_args();
     if (count($args) === 1 && is_array($args[0])) {
         $this->data->replace($args[0]);
     } elseif (count($args) === 2) {
         // Ensure original behavior is maintained. DO NOT invoke stored Closures.
         if (is_object($args[1]) && method_exists($args[1], '__invoke')) {
             $this->data->set($args[0], $this->data->protect($args[1]));
         } else {
             $this->data->set($args[0], $args[1]);
         }
     } else {
         throw new \InvalidArgumentException('Cannot set View data with provided arguments. Usage: `View::setData( $key, $value );` or `View::setData([ key => value, ... ]);`');
     }
 }
Beispiel #5
0
 public function __set($name, $value)
 {
     $this->container->set($name, $value);
 }