/** * 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, ... ]);`'); } }