Example #1
0
 /**
  * _assignData
  *
  * Assign data into output
  *
  * @param  mixed $item     Associative array or string key of next argument
  * @param  mixed $i        Assigned data or null
  * @param  bool  $toPublic Assign type flag (public or protected data)
  * @return null
  */
 private static function _assignData($item, $i = null, $toPublic = false)
 {
     $data = array();
     if (!is_array($item) and $i !== null) {
         $data[$item] = $i;
     } else {
         if (is_array($item) and $i === null) {
             $data = $item;
         } else {
             if (is_object($item) and $i === null) {
                 $data = array($item);
             } else {
                 throw new SystemErrorException(array('title' => 'View error', 'description' => 'Assign method expects: view::assign(\'key\', $data);'));
             }
         }
     }
     if ($toPublic) {
         self::$_data = array_merge(self::$_data, $data);
     } else {
         self::$_protectedData = array_merge(self::$_protectedData, $data);
     }
 }