Liip\RMT\Context::createEmptyList PHP Method

createEmptyList() public method

public createEmptyList ( $id )
    public function createEmptyList($id)
    {
        $this->lists[$id] = array();
    }

Usage Example

示例#1
0
 /**
  * Context factory method.
  * 
  * @param \Liip\RMT\Application $application
  * @return \Liip\RMT\Context
  */
 public static function create(Application $application)
 {
     $rootDir = $application->getProjectRootDir();
     $helper = new Helpers\ComposerConfig();
     $helper->setComposerFile($rootDir . '/composer.json');
     $config = $helper->getRMTConfigSection();
     $context = new Context();
     $builder = new Helpers\ServiceBuilder($context);
     /*
      * The following services are config-dependent
      */
     if ($config !== null) {
         if ($config->getVcs()) {
             $context->setService('vcs', $builder->getService($config->getVcs(), 'vcs'));
         }
         // Store the config for latter usage
         $context->setParameter('config', $config);
         /*
          * populate version persister
          */
         $context->setService("version-persister", $builder->getService($config->getVersionPersister(), 'versionPersister'));
         $context->setService("version-detector", $builder->getService($config->getVersionDetector(), 'versionDetector'));
         /*
          * popluate lists
          */
         foreach (array("prerequisites", self::PRERELEASE_LIST, "postReleaseActions") as $listName) {
             $context->createEmptyList($listName);
             foreach ($config->{$listName} as $service) {
                 $context->addToList($listName, $builder->getService($service, $listName));
             }
         }
     }
     // Provide the root dir as a context parameter
     $context->setParameter('project-root', $rootDir);
     return $context;
 }