當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Tool_Project_Profile::isLoadableFromFile方法代碼示例

本文整理匯總了PHP中Zend_Tool_Project_Profile::isLoadableFromFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Tool_Project_Profile::isLoadableFromFile方法的具體用法?PHP Zend_Tool_Project_Profile::isLoadableFromFile怎麽用?PHP Zend_Tool_Project_Profile::isLoadableFromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Tool_Project_Profile的用法示例。


在下文中一共展示了Zend_Tool_Project_Profile::isLoadableFromFile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _findProfileDirectory

 protected function _findProfileDirectory($projectDirectory = null, $searchParentDirectories = true)
 {
     // use the cwd if no directory was provided
     if ($projectDirectory == null) {
         $projectDirectory = getcwd();
     } elseif (realpath($projectDirectory) == false) {
         throw new Zend_Tool_Project_Provider_Exception('The $projectDirectory supplied does not exist.');
     }
     $profile = new Zend_Tool_Project_Profile();
     $parentDirectoriesArray = explode(DIRECTORY_SEPARATOR, ltrim($projectDirectory, DIRECTORY_SEPARATOR));
     while ($parentDirectoriesArray) {
         $projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray);
         if (DIRECTORY_SEPARATOR !== "\\") {
             $projectDirectoryAssembled = DIRECTORY_SEPARATOR . $projectDirectoryAssembled;
         }
         $profile->setAttribute('projectDirectory', $projectDirectoryAssembled);
         if ($profile->isLoadableFromFile()) {
             unset($profile);
             return $projectDirectoryAssembled;
         }
         // break after first run if we are not to check upper directories
         if ($searchParentDirectories == false) {
             break;
         }
         array_pop($parentDirectoriesArray);
     }
     return false;
 }
開發者ID:fredcido,項目名稱:cenbrap,代碼行數:28,代碼來源:Abstract.php

示例2: _loadProfile

 /**
  * _getProject is designed to find if there is project file in the context of where
  * the client has been called from..   The search order is as follows..
  *    - traversing downwards from (PWD) - current working directory
  *    - if an enpoint variable has been registered in teh client registry - key=workingDirectory
  *    - if an ENV variable with the key ZFPROJECT_PATH is found
  *
  * @param $loadProfileFlag bool Whether or not to throw an exception when no profile is found
  * @param $projectDirectory string The project directory to use to search
  * @param $searchParentDirectories bool Whether or not to search upper level direcotries
  * @return Zend_Tool_Project_Profile
  */
 protected function _loadProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION, $projectDirectory = null, $searchParentDirectories = true)
 {
     // use the cwd if no directory was provided
     if ($projectDirectory == null) {
         $projectDirectory = getcwd();
     } elseif (realpath($projectDirectory) == false) {
         throw new Zend_Tool_Project_Provider_Exception('The $projectDirectory supplied does not exist.');
     }
     $profile = new Zend_Tool_Project_Profile();
     $parentDirectoriesArray = explode(DIRECTORY_SEPARATOR, ltrim($projectDirectory, DIRECTORY_SEPARATOR));
     while ($parentDirectoriesArray) {
         $projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray);
         if (DIRECTORY_SEPARATOR !== "\\") {
             $projectDirectoryAssembled = DIRECTORY_SEPARATOR . $projectDirectoryAssembled;
         }
         $profile->setAttribute('projectDirectory', $projectDirectoryAssembled);
         if ($profile->isLoadableFromFile()) {
             chdir($projectDirectoryAssembled);
             $profile->loadFromFile();
             $this->_loadedProfile = $profile;
             break;
         }
         // break after first run if we are not to check upper directories
         if ($searchParentDirectories == false) {
             break;
         }
         array_pop($parentDirectoriesArray);
     }
     if ($this->_loadedProfile == null) {
         if ($loadProfileFlag == self::NO_PROFILE_THROW_EXCEPTION) {
             throw new Zend_Tool_Project_Provider_Exception('A project profile was not found.');
         } elseif ($loadProfileFlag == self::NO_PROFILE_RETURN_FALSE) {
             return false;
         }
     }
     return $profile;
 }
開發者ID:travisj,項目名稱:zf,代碼行數:49,代碼來源:Abstract.php

示例3: testProfileFromVariousSourcesIsLoadableFromFile

 public function testProfileFromVariousSourcesIsLoadableFromFile()
 {
     $profile = new Zend_Tool_Project_Profile();
     // no options, should return false
     $this->assertFalse($profile->isLoadableFromFile());
     // invalid file path, should be false
     $profile->setAttribute('projectProfileFile', $this->_projectProfileFile . '.invalid-file');
     $this->assertFalse($profile->isLoadableFromFile());
     // valid file path, shoudl be true
     $profile->setAttribute('projectProfileFile', $this->_projectProfileFile);
     $this->assertTrue($profile->isLoadableFromFile());
     // just project directory
     $profile = new Zend_Tool_Project_Profile();
     // shoudl be false with non existent directory
     $profile->setAttribute('projectDirectory', $this->_projectDirectory . 'non-existent/dir/');
     $this->assertFalse($profile->isLoadableFromFile());
     // should return true for proper directory
     copy($this->_projectProfileFile, $this->_projectDirectory . '/.zfproject.xml');
     $profile->setAttribute('projectDirectory', $this->_projectDirectory);
     $this->assertTrue($profile->isLoadableFromFile());
 }
開發者ID:omusico,項目名稱:logica,代碼行數:21,代碼來源:ProfileTest.php

示例4: _loadProfile

 /**
  * _getProject is designed to find if there is project file in the context of where
  * the client has been called from..   The search order is as follows..
  *    - traversing downwards from (PWD) - current working directory
  *    - if an enpoint variable has been registered in teh client registry - key=workingDirectory
  *    - if an ENV variable with the key ZFPROJECT_PATH is found
  *
  * @
  * @return Zend_Tool_Project_Profile
  */
 protected function _loadProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION, $projectDirectory = null)
 {
     if ($projectDirectory == null) {
         $projectDirectory = getcwd();
     }
     $profile = new Zend_Tool_Project_Profile();
     $profile->setAttribute('projectDirectory', $projectDirectory);
     if ($profile->isLoadableFromFile()) {
         $profile->loadFromFile();
         $this->_loadedProfile = $profile;
     }
     if ($this->_loadedProfile == null) {
         if ($loadProfileFlag == self::NO_PROFILE_THROW_EXCEPTION) {
             throw new Zend_Tool_Project_Provider_Exception('A project profile was not found.');
         } elseif ($loadProfileFlag == self::NO_PROFILE_RETURN_FALSE) {
             return false;
         }
     }
     return $profile;
 }
開發者ID:VUW-SIM-FIS,項目名稱:emiemi,代碼行數:30,代碼來源:Abstract.php


注:本文中的Zend_Tool_Project_Profile::isLoadableFromFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。