示例#1
0
 public static function searching(IContainer $aParent, $aCallback)
 {
     $arrRes = array();
     foreach ($aParent->iterator() as $aChild) {
         if (call_user_func_array($aCallback, array($aChild))) {
             $arrRes[] = $aChild;
         }
         // 递归child
         $arrRes = array_merge($arrRes, self::searching($aChild, $aCallback));
     }
     return $arrRes;
 }
示例#2
0
文件: View.php 项目: JeCat/framework
 /**
  * @return IView
  */
 public static function findXPath(IContainer $aViewContainer, $sViewXPath)
 {
     $arrPath = explode('/', $sViewXPath);
     $aView = $aViewContainer;
     while (($sViewName = array_shift($arrPath)) !== null) {
         if (empty($sViewName)) {
             continue;
         }
         if (!($aView = $aViewContainer->getByName($sViewName))) {
             return null;
         }
         $aViewContainer = $aView;
     }
     return $aView;
 }