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


PHP PhingFile::contents方法代碼示例

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


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

示例1: build

 /**
  * Uses a builder class to create the output class.
  * This method assumes that the DataModelBuilder class has been initialized with the build properties.
  *
  * @param OMBuilder $builder
  * @param boolean   $overwrite Whether to overwrite existing files with te new ones (default is YES).
  *
  * @todo       -cPropelOMTask Consider refactoring build() method into AbstractPropelDataModelTask (would need to be more generic).
  * @return int
  */
 protected function build(OMBuilder $builder, $overwrite = true)
 {
     $path = $builder->getClassFilePath();
     $this->ensureDirExists(dirname($path));
     $_f = new PhingFile($this->getOutputDirectory(), $path);
     // skip files already created once
     if ($_f->exists() && !$overwrite) {
         $this->log("\t-> (exists) " . $builder->getClassFilePath(), Project::MSG_VERBOSE);
         return 0;
     }
     $script = $builder->build();
     foreach ($builder->getWarnings() as $warning) {
         $this->log($warning, Project::MSG_WARN);
     }
     // skip unchanged files
     if ($_f->exists() && $script == $_f->contents()) {
         $this->log("\t-> (unchanged) " . $builder->getClassFilePath(), Project::MSG_VERBOSE);
         return 0;
     }
     // write / overwrite new / changed files
     $action = $_f->exists() ? 'Updating' : 'Creating';
     $this->log(sprintf("\t-> %s %s (table: %s, builder: %s)", $action, $builder->getClassFilePath(), $builder->getTable()->getName(), get_class($builder)));
     file_put_contents($_f->getAbsolutePath(), $script);
     return 1;
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:35,代碼來源:PropelOMTask.php

示例2: parseFile

 /**
  * Parses a XML input file and returns a newly created and
  * populated AppData structure.
  *
  * @param      string $xmlFile The input file to parse.
  * @return     AppData populated by <code>xmlFile</code>.
  */
 public function parseFile($xmlFile)
 {
     // we don't want infinite recursion
     if ($this->isAlreadyParsed($xmlFile)) {
         return;
     }
     $f = new PhingFile($xmlFile);
     return $this->parseString($f->contents(), $xmlFile);
 }
開發者ID:nextbigsound,項目名稱:propel-orm,代碼行數:16,代碼來源:XmlToAppData.php


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