本文整理汇总了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;
}