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


PHP BuildEvent::addPackage方法代码示例

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


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

示例1: populateReleases

 /**
  * Produce a indexable directory of BuildEvents from the Packages
  * collection, grouping them according to the version number of the
  * 'Doomsday' packages those events produced.
  *
  * The version number (string) is used as key to each record.
  *
  * @param matrix  (Array) will be populated with new records.
  * @return  (Mixed) FALSE if no packages were added to the matrix
  *          otherwise the number of added packages (integer).
  */
 private function populateReleases(&$releases)
 {
     if (!is_array($releases)) {
         throw new Exception('populateReleases: Invalid matrix argument, array expected.');
     }
     if (!isset($this->packages)) {
         return FALSE;
     }
     // Running total of the number of events we add to the matrix.
     $numEventsAdded = (int) 0;
     foreach ($this->packages as &$pack) {
         // We are only interested in the 'Doomsday' packages.
         if ($pack->title() !== 'Doomsday') {
             continue;
         }
         // Have we encountered this version before?.
         $versionText = "{$pack->version()}";
         $key = array_casekey_exists($versionText, $releases);
         if ($key === false) {
             // Not yet construct a new record and associate it
             // in the release list using the version number as the key.
             $key = ucwords($versionText);
             $releases[$key] = $this->newReleaseInfo($key);
             $releaseInfo =& $releases[$key];
         } else {
             $releaseInfo =& $releases[$versionText];
         }
         $build = NULL;
         // Is this package a product of the autobuilder?
         if ($pack instanceof iBuilderProduct) {
             // Yes; we have "real" BuildEvent we can link with this.
             $buildUniqueId = $pack->buildUniqueId();
             $build = $this->buildByUniqueId($buildUniqueId);
         } else {
             // No - this must be a symbolic package.
             // We'll instantiate a symbolic BuildEvent for this.
             $build = new BuildEvent(0, $pack->hasReleaseDate() ? $pack->releaseDate() : strtotime('Jan 8, 2005'), 'skyjake', 'jaakko.keranen@iki.fi', RT_STABLE);
             if ($pack->hasReleaseNotesUri()) {
                 $build->setReleaseNotesUri($pack->releaseNotesUri());
             }
             if ($pack->hasReleaseChangeLogUri()) {
                 $build->setReleaseChangeLogUri($pack->releaseChangeLogUri());
             }
             $build->addPackage($pack);
         }
         if (!$build instanceof BuildEvent) {
             continue;
         }
         // Odd...
         // Is a build event already present for this release version?
         $latestBuild = isset($releaseInfo['latestBuild']) ? $releaseInfo['latestBuild'] : NULL;
         if ($latestBuild instanceof BuildEvent) {
             // Is this a newer build?
             if ($build->uniqueId() > $latestBuild->uniqueId()) {
                 $releaseInfo['latestBuild'] = $build;
             }
         } else {
             $releaseInfo['latestBuild'] = $build;
         }
         // Promote the status of the release due to this package?
         $releaseTypeId = $build->releaseTypeId();
         if ($releaseTypeId > $releaseInfo['releaseTypeId']) {
             $releaseInfo['releaseTypeId'] = $releaseTypeId;
         }
     }
     return $numEventsAdded;
 }
开发者ID:laszloekovacs,项目名称:Doomsday-Engine,代码行数:78,代码来源:buildrepository.php


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