Ejemplo n.º 1
0
 /**
  * @param string $key
  *
  * @return mixed|null
  * @throws ConfigurationException
  */
 protected function getConfigValue($key)
 {
     $this->getConfig();
     if (null !== ($data = $this->config->get($key))) {
         return $data;
     }
     return '';
 }
Ejemplo n.º 2
0
 /**
  * AbstractWorkflowCommand constructor.
  *
  * @param string $origin
  * @param string $stable
  */
 public function __construct(Config $config)
 {
     $this->config = $config;
     $this->origin = $config->get('twgit.git.origin', 'origin');
     $this->stable = $config->get('twgit.git.stable', 'stable');
     $this->prefixes = [self::FEATURE => $config->get('twgit.workflow.prefixes.feature', 'feature-'), self::RELEASE => $config->get('twgit.workflow.prefixes.release', 'release-'), self::HOTFIX => $config->get('twgit.workflow.prefixes.hotfix', 'hotfix-'), self::DEMO => $config->get('twgit.workflow.prefixes.demo', 'demo-'), self::TAG => $config->get('twgit.workflow.prefixes.tag', 'v')];
     $this->firstCommitMessage = $config->get('twgit.commit.first_commit_message', '[twgit] Init %s %s %s');
     $this->featuresSubjectFilename = $config->get('twgit.features.subject_filename', '.twgit_features_subject');
     $this->setConnector(new NullConnector());
 }
Ejemplo n.º 3
0
 /**
  * @param string $type
  * @param Config $config
  * @param Client $client
  *
  * @return AbstractConnectorCommand
  * @throws ConfigurationException
  */
 public function create($type, Config $config, Client $client)
 {
     $class = sprintf('NMR\\Connector\\%sConnector', ucfirst($type));
     if (!class_exists($class)) {
         throw new ConfigurationException(sprintf('Invalid Connector "%s".', $type));
     }
     $reflectionClass = new ReflectionClass($class);
     $constructorParameters = $reflectionClass->getConstructor()->getParameters();
     $parameters = [];
     /** @var ReflectionParameter $constructorParameter */
     foreach ($constructorParameters as $constructorParameter) {
         $name = $constructorParameter->getName();
         $configName = sprintf('twgit.connectors.%s.%s', $type, TextUtil::convertCamelCaseToSeparator($name));
         $parameters[] = $config->get($configName, '');
     }
     $instance = $reflectionClass->newInstanceArgs($parameters);
     $instance->setClient($client);
     return $instance;
 }