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


PHP Properties::store方法代码示例

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


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

示例1: main

 /**
  * Executes the task.
  */
 public function main()
 {
     if ($this->file === null) {
         throw new BuildException('The file attribute must be set');
     }
     $properties = new Properties();
     if ($this->update === true) {
         /* Load existing properties. */
         try {
             $properties->load($this->file);
         } catch (IOException $ioe) {
             /* File doesn't exist or isn't readable, so don't worry here. */
         }
     }
     /* Add new properties. */
     foreach ($this->properties as $property) {
         foreach ($property->resolve()->getProperties() as $name => $value) {
             $properties->setProperty($name, $value);
         }
     }
     $properties->store($this->file, 'Automatically-updated properties file ' . 'generated by the Agavi write-properties task');
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:25,代码来源:AgaviWritepropertiesTask.php

示例2: createSqlDbMap

 /**
  * Create the sql -> database map.
  *
  * @throws IOException - if unable to store properties
  */
 private function createSqlDbMap()
 {
     if ($this->getSqlDbMap() === null) {
         return;
     }
     // Produce the sql -> database map
     $sqldbmap = new Properties();
     // Check to see if the sqldbmap has already been created.
     if ($this->getSqlDbMap()->exists()) {
         $sqldbmap->load($this->getSqlDbMap());
     }
     if ($this->packageObjectModel) {
         // in this case we'll get the sql file name from the package attribute
         $dataModels = $this->packageDataModels();
         foreach ($dataModels as $package => $dataModel) {
             foreach ($dataModel->getDatabases() as $database) {
                 $name = ($package ? $package . '.' : '') . 'schema.xml';
                 $sqlFile = $this->getMappedFile($name);
                 $sqldbmap->setProperty($sqlFile->getName(), $database->getName());
             }
         }
     } else {
         // the traditional way is to map the schema.xml filenames
         $dmMap = $this->getDataModelDbMap();
         foreach (array_keys($dmMap) as $dataModelName) {
             $sqlFile = $this->getMappedFile($dataModelName);
             if ($this->getDatabase() === null) {
                 $databaseName = $dmMap[$dataModelName];
             } else {
                 $databaseName = $this->getDatabase();
             }
             $sqldbmap->setProperty($sqlFile->getName(), $databaseName);
         }
     }
     try {
         $sqldbmap->store($this->getSqlDbMap(), "Sqlfile -> Database map");
     } catch (IOException $e) {
         throw new IOException("Unable to store properties: " . $e->getMessage());
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:45,代码来源:PropelSQLTask.php

示例3: merge

 static function merge($project, $codeCoverageInformation)
 {
     $coverageDatabase = $project->getProperty('coverage.database');
     if (!$coverageDatabase) {
         throw new BuildException("Property coverage.database is not set - please include coverage-setup in your build file");
     }
     $database = new PhingFile($coverageDatabase);
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $filename => $data) {
         if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) {
             $ignoreLines = PHP_CodeCoverage_Util::getLinesToBeIgnored($filename);
         } else {
             // FIXME retrieve ignored lines for PHPUnit Version < 3.5.0
             $ignoreLines = array();
         }
         $lines = array();
         $filename = strtolower($filename);
         if ($props->getProperty($filename) != null) {
             foreach ($data as $_line => $_data) {
                 if (is_array($_data)) {
                     $count = count($_data);
                 } else {
                     if (isset($ignoreLines[$_line])) {
                         // line is marked as ignored
                         $count = 1;
                     } else {
                         if ($_data == -1) {
                             // not executed
                             $count = -1;
                         } else {
                             if ($_data == -2) {
                                 // dead code
                                 $count = -2;
                             }
                         }
                     }
                 }
                 $lines[$_line] = $count;
             }
             ksort($lines);
             $file = unserialize($props->getProperty($filename));
             $left = $file['coverage'];
             $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $lines);
             $file['coverage'] = $coverageMerged;
             $props->setProperty($filename, serialize($file));
         }
     }
     $props->store($database);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:51,代码来源:CoverageMerger.php

示例4: createDataDbMap

 /**
  * Create the data XML -> database map.
  *
  * This is necessary because there is currently no other method of knowing which
  * data XML files correspond to which database.  This map allows us to convert multiple
  * data XML files into SQL.
  *
  * @throws IOException - if unable to store properties
  */
 private function createDataDbMap()
 {
     if ($this->getDataDbMap() === null) {
         return;
     }
     // Produce the sql -> database map
     $datadbmap = new Properties();
     // Check to see if the sqldbmap has already been created.
     if ($this->getDataDbMap()->exists()) {
         $datadbmap->load($this->getDataDbMap());
     }
     foreach ($this->getDataModels() as $dataModel) {
         // there is really one 1 db per datamodel
         foreach ($dataModel->getDatabases() as $database) {
             // if database name is specified, then we only want to dump that one db.
             if (empty($this->databaseName) || $this->databaseName && $database->getName() == $this->databaseName) {
                 $outFile = $this->getMappedFile($dataModel->getName());
                 $datadbmap->setProperty($outFile->getName(), $database->getName());
             }
         }
     }
     try {
         $datadbmap->store($this->getDataDbMap(), "Data XML file -> Database map");
     } catch (IOException $e) {
         throw new IOException("Unable to store properties: " . $e->getMessage());
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:36,代码来源:PropelDataDumpTask.php

示例5: main

 function main()
 {
     $files = $this->getFilenames();
     $this->log("Setting up coverage database for " . count($files) . " files");
     $props = new Properties();
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         $filename = $file['key'];
         $props->setProperty($filename, serialize(array('fullname' => $fullname, 'coverage' => array())));
     }
     $dbfile = new PhingFile($this->database);
     $props->store($dbfile);
     $this->project->setProperty('coverage.database', $dbfile->getAbsolutePath());
 }
开发者ID:namesco,项目名称:phing,代码行数:14,代码来源:CoverageSetupTask.php

示例6: main

 function main()
 {
     $files = $this->getFilenames();
     $this->log("Setting up coverage database for " . count($files) . " files");
     $props = new Properties();
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         $filename = $file['key'];
         $props->setProperty($filename, serialize(array('fullname' => $fullname, 'coverage' => array())));
     }
     $dbfile = new PhingFile($this->database);
     $props->store($dbfile);
     $this->project->setProperty('coverage.database', $dbfile->getAbsolutePath());
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
         Phing::__import($fullname, $this->classpath);
         $coverage = xdebug_get_code_coverage();
         xdebug_stop_code_coverage();
         CoverageMerger::merge($this->project, array($coverage));
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:22,代码来源:CoverageSetupTask.php

示例7: merge

 static function merge($project, $codeCoverageInformation)
 {
     $database = new PhingFile($project->getProperty('coverage.database'));
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $coverage) {
         foreach ($coverage as $filename => $coverageFile) {
             $filename = strtolower($filename);
             if ($props->getProperty($filename) != null) {
                 $file = unserialize($props->getProperty($filename));
                 $left = $file['coverage'];
                 $right = $coverageFile;
                 if (!is_array($right)) {
                     $right = array_shift(PHPUnit_Util_CodeCoverage::bitStringToCodeCoverage(array($right), 1));
                 }
                 $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $right);
                 foreach ($coverageMerged as $key => $value) {
                     if ($value == -2) {
                         unset($coverageMerged[$key]);
                     }
                 }
                 $file['coverage'] = $coverageMerged;
                 $props->setProperty($filename, serialize($file));
             }
         }
     }
     $props->store($database);
 }
开发者ID:nhemsley,项目名称:phing,代码行数:29,代码来源:CoverageMerger.php

示例8: main

 /**
  * Main method parses the XML files and creates SQL files.
  *
  * @return void
  * @throws Exception If there is an error parsing the data xml.
  */
 public function main()
 {
     $this->validate();
     $targetDatabase = $this->getTargetDatabase();
     $platform = $this->getPlatformForTargetDatabase();
     // Load the Data XML -> DB Name properties
     $map = new Properties();
     try {
         $map->load($this->getDataDbMap());
     } catch (IOException $ioe) {
         throw new BuildException("Cannot open and process the datadbmap!", $ioe);
     }
     DataModelBuilder::setBuildProperties($this->getPropelProperties());
     // Parse each file in teh data -> db map
     foreach ($map->keys() as $dataXMLFilename) {
         $dataXMLFile = new PhingFile($this->srcDir, $dataXMLFilename);
         // if file exists then proceed
         if ($dataXMLFile->exists()) {
             $dbname = $map->get($dataXMLFilename);
             $db = $this->getDatabase($dbname);
             if (!$db) {
                 throw new BuildException("Cannot find instantiated Database for name '{$dbname}' from datadbmap file.");
             }
             $db->setPlatform($platform);
             $outFile = $this->getMappedFile($dataXMLFilename);
             $this->log("Creating SQL from XML data dump file: " . $dataXMLFile->getAbsolutePath());
             try {
                 $dataXmlParser = new XmlToData($db, $this->dbEncoding);
                 $data = $dataXmlParser->parseFile($dataXMLFile->getAbsolutePath());
             } catch (Exception $e) {
                 throw new Exception("Exception parsing data XML: " . $e->getMessage());
             }
             $fp = fopen($outFile->getAbsolutePath(), 'w');
             $currTable = null;
             foreach ($data as $dataRow) {
                 if ($currTable !== $dataRow->getTable()) {
                     $currTable = $dataRow->getTable();
                     $builder = DataModelBuilder::builderFactory($currTable, 'datasql');
                 }
                 $sql = $builder->buildRowSql($dataRow);
                 fwrite($fp, $sql);
             }
             fclose($fp);
             // Place the generated SQL file(s)
             $p = new Properties();
             if ($this->getSqlDbMap()->exists()) {
                 $p->load($this->getSqlDbMap());
             }
             $p->setProperty($outFile->getName(), $db->getName());
             $p->store($this->getSqlDbMap(), "Sqlfile -> Database map");
         } else {
             $this->log("File '" . $dataXMLFile->getAbsolutePath() . "' in datadbmap does not exist, so skipping it.", PROJECT_MSG_WARN);
         }
     }
     // foreach data xml file
 }
开发者ID:DBezemer,项目名称:server,代码行数:62,代码来源:PropelDataSQLTask.php

示例9: main

 /**
  * Main method parses the XML files and creates SQL files.
  *
  * @return void
  * @throws Exception      If there is an error parsing the data xml.
  * @throws BuildException
  */
 public function main()
 {
     $this->validate();
     $targetDatabase = $this->getTargetDatabase();
     $platform = $this->getGeneratorConfig()->getConfiguredPlatform();
     // Load the Data XML -> DB Name properties
     $map = new Properties();
     try {
         $map->load($this->getDataDbMap());
     } catch (IOException $ioe) {
         throw new BuildException("Cannot open and process the datadbmap!", $ioe);
     }
     // Parse each file in the data -> db map
     foreach ($map->keys() as $dataXMLFilename) {
         $dataXMLFile = new PhingFile($this->srcDir, $dataXMLFilename);
         // if file exists then proceed
         if ($dataXMLFile->exists()) {
             $dbname = $map->get($dataXMLFilename);
             $db = $this->getDatabase($dbname);
             if (!$db) {
                 throw new BuildException("Cannot find instantiated Database for name '{$dbname}' from datadbmap file.");
             }
             $db->setPlatform($platform);
             $outFile = $this->getMappedFile($dataXMLFilename);
             $sqlWriter = new FileWriter($outFile);
             $this->log("Creating SQL from XML data dump file: " . $dataXMLFile->getAbsolutePath());
             try {
                 $dataXmlParser = new XmlToDataSQL($db, $this->getGeneratorConfig(), $this->dbEncoding);
                 $dataXmlParser->transform($dataXMLFile, $sqlWriter);
             } catch (Exception $e) {
                 throw new BuildException("Exception parsing data XML: " . $e->getMessage(), $x);
             }
             // Place the generated SQL file(s)
             $p = new Properties();
             if ($this->getSqlDbMap()->exists()) {
                 $p->load($this->getSqlDbMap());
             }
             $p->setProperty($outFile->getName(), $db->getName());
             $p->store($this->getSqlDbMap(), "Sqlfile -> Database map");
         } else {
             $this->log("File '" . $dataXMLFile->getAbsolutePath() . "' in datadbmap does not exist, so skipping it.", Project::MSG_WARN);
         }
     }
     // foreach data xml file
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:52,代码来源:PropelDataSQLTask.php

示例10: merge

 static function merge($project, $codeCoverageInformation)
 {
     $coverageDatabase = $project->getProperty('coverage.database');
     if (!$coverageDatabase) {
         throw new BuildException("Property coverage.database is not set - please include coverage-setup in your build file");
     }
     $database = new PhingFile($coverageDatabase);
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $filename => $data) {
         $lines = array();
         $filename = strtolower($filename);
         if ($props->getProperty($filename) != null) {
             foreach ($data as $_line => $_data) {
                 if (is_array($_data)) {
                     $count = count($_data);
                 } else {
                     if ($_data == -1) {
                         // not executed
                         $count = -1;
                     } else {
                         if ($_data == -2) {
                             // dead code
                             $count = -2;
                         }
                     }
                 }
                 $lines[$_line] = $count;
             }
             ksort($lines);
             $file = unserialize($props->getProperty($filename));
             $left = $file['coverage'];
             $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $lines);
             $file['coverage'] = $coverageMerged;
             $props->setProperty($filename, serialize($file));
         }
     }
     $props->store($database);
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:40,代码来源:CoverageMerger.php

示例11: merge

 static function merge($project, $codeCoverageInformation)
 {
     $database = new PhingFile($project->getProperty('coverage.database'));
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $coverage) {
         foreach ($coverage as $filename => $coverageFile) {
             $filename = strtolower($filename);
             if ($props->getProperty($filename) != null) {
                 $file = unserialize($props->getProperty($filename));
                 $left = $file['coverage'];
                 $right = $coverageFile;
                 $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $right);
                 $file['coverage'] = $coverageMerged;
                 $props->setProperty($filename, serialize($file));
             }
         }
     }
     $props->store($database);
 }
开发者ID:superchangme,项目名称:jsplugin,代码行数:21,代码来源:CoverageMerger.php

示例12: main

 function main()
 {
     /**
      * Whitelist files when using PHPUnit > 3.5
      */
     @(include_once 'PHPUnit/Runner/Version.php');
     if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) {
         $newFilter = true;
     } else {
         $newFilter = false;
         @(include_once 'PHPUnit/Util/Filter.php');
     }
     $files = $this->getFilenames();
     $this->log("Setting up coverage database for " . count($files) . " files");
     $props = new Properties();
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         $filename = $file['key'];
         $props->setProperty($filename, serialize(array('fullname' => $fullname, 'coverage' => array())));
         if ($newFilter) {
             PHP_CodeCoverage_Filter::getInstance()->addFileToWhiteList($file['fullname']);
         } else {
             PHPUnit_Util_Filter::addFileToWhitelist($file['fullname']);
         }
     }
     $dbfile = new PhingFile($this->database);
     $props->store($dbfile);
     $this->project->setProperty('coverage.database', $dbfile->getAbsolutePath());
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:29,代码来源:CoverageSetupTask.php


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