コード例 #1
0
ファイル: Blueprint.php プロジェクト: realitygaps/grav_ynh
 /**
  * Extend blueprint with another blueprint.
  *
  * @param Blueprint $extends
  * @param bool $append
  */
 public function extend(Blueprint $extends, $append = false)
 {
     $blueprints = $append ? $this->items : $extends->toArray();
     $appended = $append ? $extends->toArray() : $this->items;
     $bref_stack = array(&$blueprints);
     $head_stack = array($appended);
     do {
         end($bref_stack);
         $bref =& $bref_stack[key($bref_stack)];
         $head = array_pop($head_stack);
         unset($bref_stack[key($bref_stack)]);
         foreach (array_keys($head) as $key) {
             if (isset($key, $bref[$key]) && is_array($bref[$key]) && is_array($head[$key])) {
                 $bref_stack[] =& $bref[$key];
                 $head_stack[] = $head[$key];
             } else {
                 $bref = array_merge($bref, array($key => $head[$key]));
             }
         }
     } while (count($head_stack));
     $this->items = $blueprints;
 }
コード例 #2
0
ファイル: Package.php プロジェクト: qbi/datenknoten.me
 /**
  * @return array
  */
 public function toArray()
 {
     return $this->blueprints->toArray();
 }