本文整理匯總了PHP中ArrayUtil::assocPeek方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayUtil::assocPeek方法的具體用法?PHP ArrayUtil::assocPeek怎麽用?PHP ArrayUtil::assocPeek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil::assocPeek方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFindAllMainByExpressionAndObject
public function testFindAllMainByExpressionAndObject()
{
$aMainPaths = ResourceFinder::findResourcesByExpressions(array('lib', 'main.php'));
$this->assertSame(1, count($aMainPaths));
$oFileRes = new FileResource(ArrayUtil::assocPeek($aMainPaths));
$this->assertSame(array($oFileRes->getRelativePath() => MAIN_DIR . '/base/lib/main.php'), $aMainPaths);
}
示例2: findRapilaClass
private static function findRapilaClass($sClassName)
{
$sFileName = "{$sClassName}.php";
//Standard Classes
$sPath = ResourceFinder::create()->addPath(DIRNAME_LIB, DIRNAME_CLASSES, $sFileName)->find();
if ($sPath) {
return $sPath;
}
//Generated Model classes
$sPath = ResourceFinder::create()->addPath(DIRNAME_GENERATED, DIRNAME_MODEL, $sFileName)->searchMainOnly()->find();
if ($sPath) {
return $sPath;
}
$sPath = ResourceFinder::create()->addPath(DIRNAME_GENERATED, DIRNAME_MODEL, false, $sFileName)->byExpressions()->searchMainOnly()->find();
if (($sPath = ArrayUtil::assocPeek($sPath)) !== null) {
return $sPath;
}
//Model classes
$sPath = ResourceFinder::create()->addPath(DIRNAME_LIB, DIRNAME_MODEL, $sFileName)->find();
if ($sPath) {
return $sPath;
}
$sPath = ResourceFinder::create()->addPath(DIRNAME_LIB, DIRNAME_MODEL, false, $sFileName)->byExpressions()->find();
if (($sPath = ArrayUtil::assocPeek($sPath)) !== null) {
return $sPath;
}
if (Module::isValidModuleClassNameOfAnyType($sClassName)) {
foreach (Module::listModuleTypes() as $sModuleType) {
$sModuleBaseClass = Module::getClassNameByTypeAndName($sModuleType);
if (!class_exists($sModuleBaseClass)) {
continue;
}
if ($sModuleBaseClass::isValidModuleClassName($sClassName)) {
$sPath = ResourceFinder::create(array(DIRNAME_MODULES, $sModuleType, $sModuleBaseClass::getNameByClassName($sClassName), $sFileName))->find();
if ($sPath) {
return $sPath;
}
}
}
}
return null;
}