Exemple #1
0
 /**
  * Override options for a task
  *
  * The order of the options is:
  *
  *   Deployment, Node, Application, Task
  *
  * A task option will always override more global options from the
  * Deployment, Node or Application.
  *
  * Global options for a task should be prefixed with the task name to prevent naming
  * issues between different tasks. For example passing a special option to the
  * GitCheckoutTask could be expressed like 'TYPO3\\Surf\\Task\\GitCheckoutTask[sha1]' => '1234...'.
  *
  * @param string $taskName
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param array $taskOptions
  * @return array
  */
 protected function overrideOptions($taskName, Deployment $deployment, Node $node, Application $application, array $taskOptions)
 {
     $globalOptions = array_merge($deployment->getOptions(), $node->getOptions(), $application->getOptions());
     $globalTaskOptions = array();
     foreach ($globalOptions as $optionKey => $optionValue) {
         if (strlen($optionKey) > strlen($taskName) && strpos($optionKey, $taskName) === 0 && $optionKey[strlen($taskName)] === '[') {
             $globalTaskOptions[substr($optionKey, strlen($taskName) + 1, -1)] = $optionValue;
         }
     }
     return array_merge($globalOptions, $globalTaskOptions, $taskOptions);
 }