Пример #1
0
 /**
  * Clone the current View
  *
  * @param RendererInterface $view   View
  * @param array             $values Variables to populate in the view
  *
  * @return RendererInterface
  */
 public function assignVars($view, $values)
 {
     if (!empty($values)) {
         if (is_array($values)) {
             $view->vars()->assign($values);
         } elseif (is_object($values)) {
             if (null !== ($objectKey = $this->getObjectKey())) {
                 $view->vars()->offsetSet($objectKey, $values);
             } elseif (method_exists($values, 'toArray')) {
                 $view->vars()->assign($values->toArray());
             } else {
                 $view->vars()->assign(get_object_vars($values));
             }
         }
     }
 }