当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Tool_Project_Profile::setAttribute方法代码示例

本文整理汇总了PHP中Zend_Tool_Project_Profile::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Tool_Project_Profile::setAttribute方法的具体用法?PHP Zend_Tool_Project_Profile::setAttribute怎么用?PHP Zend_Tool_Project_Profile::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Tool_Project_Profile的用法示例。


在下文中一共展示了Zend_Tool_Project_Profile::setAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testProfileCanSaveStorageDataToFile

 public function testProfileCanSaveStorageDataToFile()
 {
     $this->_standardProfileFromData->loadFromData();
     $this->_standardProfileFromData->setAttribute('projectProfileFile', $this->_projectDirectory . 'my-xml-file.xml');
     $this->_standardProfileFromData->storeToFile();
     $this->assertTrue(file_exists($this->_projectDirectory . 'my-xml-file.xml'));
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:7,代码来源:ProfileTest.php

示例2: unserialize

    /**
     * unserialize()
     *
     * Create a structure in the object $profile from the structure specficied
     * in the xml string provided
     *
     * @param string xml data
     * @param Zend_Tool_Project_Profile The profile to use as the top node
     * @return Zend_Tool_Project_Profile
     */
    public function unserialize($data, Zend_Tool_Project_Profile $profile)
    {
        if ($data == null) {
            throw new Exception('contents not available to unserialize.');
        }

        $this->_profile = $profile;

        $xmlDataIterator = new SimpleXMLIterator($data);

        if ($xmlDataIterator->getName() != 'projectProfile') {
            throw new Exception('Profiles must start with a projectProfile node');
        }

        if (isset($xmlDataIterator['type'])) {
            $this->_profile->setAttribute('type', (string) $xmlDataIterator['type']);
        }

        if (isset($xmlDataIterator['version'])) {
            $this->_profile->setAttribute('version', (string) $xmlDataIterator['version']);
        }

        // start un-serialization of the xml doc
        $this->_unserializeRecurser($xmlDataIterator);

        // contexts should be initialized after the unwinding of the profile structure
        $this->_lazyLoadContexts();

        return $this->_profile;

    }
开发者ID:nhp,项目名称:shopware-4,代码行数:41,代码来源:Xml.php

示例3: _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

示例4: testProfileThrowsExceptionOnLoadFromFileWithBadPathForProfileFile

 /**
  *
  * @expectedException Zend_Tool_Project_Exception
  */
 public function testProfileThrowsExceptionOnLoadFromFileWithBadPathForProfileFile()
 {
     $profile = new Zend_Tool_Project_Profile();
     $profile->setAttribute('projectProfileFile', '/path/should/not/exist');
     // missing file path or project path
     $profile->loadFromFile();
 }
开发者ID:omusico,项目名称:logica,代码行数:11,代码来源:ProfileTest.php

示例5: _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

示例6: _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::setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。