public function addConfiguration(NodeDefinition $node)
 {
     $node->fixXmlConfig('user_provider');
     $builder = $node->beforeNormalization()->ifTrue(function ($v) {
         return isset($v['key']);
     })->then(function ($v) {
         if (isset($v['secret'])) {
             throw new \LogicException('Cannot set both key and secret options for remember_me, use only secret instead.');
         }
         @trigger_error('remember_me.key is deprecated since version 2.8 and will be removed in 3.0. Use remember_me.secret instead.', E_USER_DEPRECATED);
         $v['secret'] = $v['key'];
         unset($v['key']);
         return $v;
     })->end()->children();
     $builder->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()->scalarNode('token_provider')->end()->arrayNode('user_providers')->beforeNormalization()->ifString()->then(function ($v) {
         return array($v);
     })->end()->prototype('scalar')->end()->end()->scalarNode('catch_exceptions')->defaultTrue()->end();
     foreach ($this->options as $name => $value) {
         if (is_bool($value)) {
             $builder->booleanNode($name)->defaultValue($value);
         } else {
             $builder->scalarNode($name)->defaultValue($value);
         }
     }
 }
Exemple #2
0
 /**
  * Generates the configuration tree builder.
  *
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('min')->isRequired()->info('Starting Number')->example('A numeric number like 1 or 1.67 or 0.87')->validate()->ifTrue(function ($v) {
         return !is_numeric($v);
     })->then(function ($v) {
         throw new EngineException('Range::min Numeric is required');
     })->end()->end()->scalarNode('max')->isRequired()->example('A numeric number like 1 or 1.67 or 0.87')->info('The maxium to use in range')->validate()->ifTrue(function ($v) {
         return !is_numeric($v);
     })->then(function ($v) {
         throw new EngineException('Range::max Numeric is required');
     })->end()->end()->scalarNode('step')->defaultValue(false)->example('1 , 1.5 , 0.6')->info('Stepping value applied on every increment, not supplied will use random')->validate()->ifTrue(function ($v) {
         return !(is_numeric($v) || $v === false);
     })->then(function ($v) {
         throw new EngineException('Range::Step option should be numeric or bool(false) to use random step');
     })->end()->end()->scalarNode('windowStep')->info('Value to add to the base after the iteration has finished (reached max)')->example(1)->defaultValue(0)->validate()->ifTrue(function ($x) {
         return !is_numeric($x);
     })->then(function ($x) {
         throw new EngineException('Range:: windowStep must be an number');
     })->end()->end()->booleanNode('random')->defaultFalse()->example('false|true')->info('Enable random step value on every loop, step param must be set to false')->end()->scalarNode('round')->defaultValue(0)->example('an integer')->info('number of places to round too')->validate()->ifTrue(function ($v) {
         return !(is_integer($v) && $v > 0);
     })->then(function ($v) {
         throw new EngineException('Range::Round option should be a positive integer >= 0');
     })->end()->end()->end();
     return $rootNode;
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $node
         ->children()
         ->end()
     ;
 }
 /**
  * @param NodeDefinition $node
  * @param string         $driver
  * @param string         $option
  *
  * @return self
  */
 private function validateDriver(NodeDefinition $node, $driver, $option)
 {
     $node->validate()->ifTrue(function ($v) use($driver, $option) {
         return $driver === $v['driver'] && empty($v['options'][$option]);
     })->thenInvalid(sprintf('The "%s" option must be defined when using the "%s" driver.', $option, $driver))->end();
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function addConfiguration(NodeDefinition $node)
 {
     $node->fixXmlConfig('header')->children()->scalarNode('auth_header')->cannotBeEmpty()->defaultValue('Authorization')->end()->scalarNode('service_label')->cannotBeEmpty()->defaultValue('HMAC')->end()->scalarNode('algorithm')->beforeNormalization()->ifString()->then(function ($v) {
         return strtolower($v);
     })->end()->validate()->ifNotInArray(hash_algos())->thenInvalid('value %s is not supported, see hash_algos() for available hashing algorithms.')->end()->defaultValue('sha256')->end()->arrayNode('verify_headers')->beforeNormalization()->ifString()->then(function ($v) {
         return array_map('trim', explode(',', $v));
     })->end()->prototype('scalar')->end()->end()->end();
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $node
         ->children()
             ->scalarNode('client')->isRequired()->end()
         ->end()
     ;
 }
 /**
  * @param NodeDefinition $node
  * @param                $name
  * @param string $info block info line
  * @param ConfigurationFactory[]|ArrayObject $factories
  */
 private function addHandlersSection(NodeDefinition $node, $name, $info, ArrayObject &$factories)
 {
     $handlersNodeBuilder = $node->children()->arrayNode($name)->info($info)->useAttributeAsKey('name')->prototype('array')->performNoDeepMerging()->children();
     foreach ($factories as $name => $factory) {
         $factoryNode = $handlersNodeBuilder->arrayNode($name)->canBeUnset();
         $factory->addConfiguration($factoryNode);
     }
 }
 /**
  * Generates the configuration tree builder.
  *
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->booleanNode('value')->isRequired()->validate()->ifTrue(function ($v) {
         return !empty($v);
     })->then(function ($v) {
         return (bool) $v;
     })->end()->info('true or false')->example('true | false')->end()->end();
     return $rootNode;
 }
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('probability')->isRequired()->info('')->example('0.3 | 0.4 | 0.5')->validate()->ifTrue(function ($v) {
         return !is_numeric($v) || !($v > 0 && $v < 1);
     })->then(function ($v) {
         throw new EngineException('PickSelector::Probability must be between 0 and  1');
     })->end()->end()->end();
     return $rootNode;
 }
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('badOption')->treatNullLike('en')->defaultValue('en')->info('Abad option')->validate()->ifTrue(function ($v) {
         return $v === 'bad';
     })->then(function ($v) {
         throw new InvalidConfigurationException('BadOption is equal to bad');
     })->end()->end();
     return $rootNode;
 }
Exemple #11
0
 public static function configureNode(NodeDefinition $node)
 {
     $node->children()->arrayNode("tags")->prototype("scalar")->end()->end()->scalarNode("query")->end()->booleanNode("filter_by_run_id")->end()->integerNode("limit")->defaultValue(10)->end()->arrayNode("processed_tags")->prototype("scalar")->end()->end()->end()->validate()->ifTrue(function ($v) {
         if ((!isset($v["tags"]) || count($v["tags"]) == 0) && !isset($v["query"])) {
             return true;
         }
         return false;
     })->thenInvalid("At least one of 'tags' or 'query' parameters must be defined.");
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $node
         ->children()
             ->scalarNode('container')->isRequired()->end()
             ->scalarNode('prefix')->defaultNull()->end()
         ->end()
     ;
 }
 protected function processNode(NodeDefinition $definition, array $config, $sectionName = true)
 {
     $processor = new Processor();
     $node = $definition->getNode(true);
     if ($sectionName) {
         $config = [$node->getName() => $config];
     }
     return $processor->process($node, $config);
 }
Exemple #14
0
 public function addConfiguration(NodeDefinition $node)
 {
     $node
         ->children()
             ->scalarNode('location')->isRequired()->end()
             ->scalarNode('archive')->defaultNull()->end()
         ->end()
     ;
 }
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('set')->isRequired()->info('The size of the set to pick from')->example('1 | 2 | 3')->validate()->ifTrue(function ($v) {
         return !is_integer($v) || (int) $v < 1;
     })->then(function ($v) {
         throw new EngineException('RandomSelector::Set size is required and must be and integer > 0');
     })->end()->end()->end();
     return $rootNode;
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $node
         ->children()
             ->scalarNode('client')->isRequired()->end()
             ->scalarNode('key')->defaultValue('flysystem')->end()
             ->scalarNode('expires')->defaultNull()->end()
         ->end()
     ;
 }
 /**
  * Generates the configuration tree builder.
  *
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('value')->isRequired()->info('The constant value to use')->end()->scalarNode('type')->info('Cast to use')->example('string|boolean|integer|float|double')->defaultValue('integer')->validate()->ifTrue(function ($v) {
         $valid_values = array(\Faker\Components\Engine\Common\Type\ConstantNumber::INTTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::STRINGTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::BOOLTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::BOOLEANTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::FLOATTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::DOUBLETYPE);
         return !in_array($v, $valid_values);
     })->then(function ($v) {
         throw new EngineException('Constant::Type Option not in valid list');
     })->end()->end()->end();
     return $rootNode;
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $builder = $node->children();
     $builder->scalarNode('provider')->end()->booleanNode('remember_me')->defaultTrue()->end()->scalarNode('success_handler')->end()->scalarNode('failure_handler')->end();
     foreach (array_merge($this->options, $this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) {
         if (is_bool($default)) {
             $builder->booleanNode($name)->defaultValue($default);
         } else {
             $builder->scalarNode($name)->defaultValue($default);
         }
     }
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $builder = $node->children();
     $builder->scalarNode('key')->isRequired()->cannotBeEmpty()->end()->scalarNode('token_provider')->end();
     foreach ($this->options as $name => $value) {
         if (is_bool($value)) {
             $builder->booleanNode($name)->defaultValue($value);
         } else {
             $builder->scalarNode($name)->defaultValue($value);
         }
     }
 }
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('step')->isRequired()->info('The number of passes to make before alternating must be an integer')->example('1 | 2 | 3')->validate()->ifTrue(function ($v) {
         return !is_integer($v) || (int) $v < 1;
     })->then(function ($v) {
         throw new EngineException('AlternateSelector::Step integer is required and must be > 0');
     })->end()->end()->scalarNode('set')->isRequired()->info('The size of the set to alternate over')->example('1 | 2 | 3')->validate()->ifTrue(function ($v) {
         return !is_integer($v) || (int) $v < 1;
     })->then(function ($v) {
         throw new EngineException('AlternateSelector::Set integer is required and must be > 0');
     })->end()->end()->end();
     return $rootNode;
 }
 /**
  * Generates the configuration tree builder.
  *
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('increment')->defaultValue(1)->info('The increment to add on every loop')->validate()->ifTrue(function ($v) {
         return !is_numeric($v);
     })->then(function ($v) {
         throw new EngineException('AutoIncrement::Increment option must be numeric');
     })->end()->end()->scalarNode('start')->validate()->ifTrue(function ($v) {
         return !is_numeric($v);
     })->then(function ($v) {
         throw new EngineException('AutoIncrement::Start option must be numeric');
     })->end()->defaultValue(1)->info('The Value to start with')->end()->end();
     return $rootNode;
 }
 /**
  * {@inheritDoc}
  */
 public function addConfiguration(NodeDefinition $builder)
 {
     $builder->validate()->always(function ($v) {
         if (!empty($v['acl']) && !empty($v['users'])) {
             throw new \Exception('"acl", and "users" cannot be set both at the same time.');
         }
         return $v;
     })->end()->fixXmlConfig('user')->children()->scalarNode('amazon_s3_id')->isRequired()->cannotBeEmpty()->end()->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end()->scalarNode('acl')->cannotBeEmpty()->end()->arrayNode('users')->prototype('array')->validate()->always(function ($v) {
         if (!empty($v['group']) === !empty($v['id'])) {
             throw new \Exception('Either "group", or "id" must be set.');
         }
         return $v;
     })->end()->children()->scalarNode('group')->cannotBeEmpty()->end()->scalarNode('id')->cannotBeEmpty()->end()->scalarNode('permission')->isRequired()->cannotBeEmpty()->end()->end()->end()->end()->booleanNode('create')->defaultFalse()->end()->arrayNode('options')->children()->booleanNode('create')->defaultFalse()->end()->scalarNode('region')->end()->scalarNode('directory')->end()->end()->end()->end();
 }
Exemple #23
0
 public function addConfiguration(NodeDefinition $node)
 {
     $node->beforeNormalization()->ifTrue(function ($v) {
         return isset($v['key']);
     })->then(function ($v) {
         if (isset($v['secret'])) {
             throw new \LogicException('Cannot set both key and secret options for http_digest, use only secret instead.');
         }
         @trigger_error('http_digest.key is deprecated since version 2.8 and will be removed in 3.0. Use http_digest.secret instead.', E_USER_DEPRECATED);
         $v['secret'] = $v['key'];
         unset($v['key']);
         return $v;
     })->end()->children()->scalarNode('provider')->end()->scalarNode('realm')->defaultValue('Secured Area')->end()->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()->end();
 }
 public function addConfiguration(NodeDefinition $node)
 {
     $builder = $node->fixXmlConfig('user_provider')->children();
     $builder->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()->scalarNode('token_provider')->end()->arrayNode('user_providers')->beforeNormalization()->ifString()->then(function ($v) {
         return array($v);
     })->end()->prototype('scalar')->end()->end()->scalarNode('catch_exceptions')->defaultTrue()->end();
     foreach ($this->options as $name => $value) {
         if (is_bool($value)) {
             $builder->booleanNode($name)->defaultValue($value);
         } else {
             $builder->scalarNode($name)->defaultValue($value);
         }
     }
 }
Exemple #25
0
 /**
  * Generates the configuration tree builder.
  *
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('countries')->defaultValue(array('AU,US,UK'))->info('a list of country codes to use')->example('AU,US,UK')->validate()->ifString()->then(function ($v) {
         # parse the values into an array
         $tokens = new TokenIterator($v, ',');
         $domains = array();
         foreach ($tokens as $domain) {
             $domains[] = $domain;
         }
         unset($tokens);
         return $domains;
     })->end()->end()->end();
     return $rootNode;
 }
 /**
  * Generates the configuration tree builder.
  *
  *  
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode(self::FORMAT)->info('Text format to use')->example('xxxxx ccccCC')->end()->scalarNode(self::REPEAT_MIN)->info('Minimum number of times to repeat the format')->example('1')->defaultValue(1)->validate()->ifTrue(function ($x) {
         return !(is_integer($x) && $x >= 0);
     })->then(function ($x) {
         $minText = \Faker\Components\Engine\Common\Type\AlphaNumeric::REPEAT_MIN;
         throw new InvalidConfigurationException('AlphaNumeric::' . $minText . ' value must be an integer greater than or equal to zero');
     })->end()->end()->scalarNode(self::REPEAT_MAX)->info('Maximum number of times to repear the format')->example('6')->defaultValue(1)->validate()->ifTrue(function ($x) {
         return !(is_integer($x) && $x > 0);
     })->then(function ($x) {
         $maxText = \Faker\Components\Engine\Common\Type\AlphaNumeric::REPEAT_MAX;
         throw new InvalidConfigurationException('AlphaNumeric::' . $maxText . ' value must be an integer greater than zero');
     })->end()->end()->end();
     return $rootNode;
 }
 /**
  * @param NodeDefinition $node
  *
  * @return NodeDefinition
  */
 private function appendNameNormalization(NodeDefinition $node)
 {
     return $node->beforeNormalization()->ifTrue(function ($array) {
         foreach ($array as $item) {
             if (false !== $item && !isset($item['name'])) {
                 return true;
             }
         }
     })->then(function ($array) {
         foreach ($array as $name => $item) {
             if (false !== $item && !isset($item['name'])) {
                 $array[$name]['name'] = $name;
             }
         }
         return $array;
     })->end();
 }
    public function addConfiguration(NodeDefinition $node)
    {
        $node
            ->children()
                ->scalarNode('host')->isRequired()->end()

                ->scalarNode('port')->defaultValue(22)->end()
                ->scalarNode('username')->defaultNull()->end()
                ->scalarNode('password')->defaultNull()->end()
                ->scalarNode('timeout')->defaultValue(90)->end()
                ->scalarNode('root')->defaultNull()->end()
                ->scalarNode('privateKey')->defaultNull()->end()
                ->scalarNode('permPrivate')->defaultValue(0000)->end()
                ->scalarNode('permPublic')->defaultNull(0744)->end()
            ->end()
        ;
    }
 /**
  * {@inheritDoc}
  */
 public function addConfiguration(NodeDefinition $builder)
 {
     $builder
         ->children()
             ->scalarNode('service_id')->isRequired()->cannotBeEmpty()->end()
             ->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end()
             ->arrayNode('options')
                 ->addDefaultsIfNotSet()
                 ->children()
                     ->scalarNode('directory')->defaultValue('')->end()
                     ->booleanNode('create')->defaultFalse()->end()
                     ->scalarNode('acl')->defaultValue('private')->end()
                 ->end()
             ->end()
         ->end()
     ;
 }
Exemple #30
0
 /**
  * Generates the configuration tree builder.
  *
  */
 public function getConfigTreeExtension(NodeDefinition $rootNode)
 {
     $rootNode->children()->scalarNode('paragraphs')->defaultValue(4)->info('Text format to use')->validate()->ifTrue(function ($v) {
         return !is_int($v);
     })->then(function ($v) {
         throw new EngineException('Numeric::Paragraphs must be and integer');
     })->end()->end()->scalarNode('maxlines')->defaultValue(200)->info('Maxium number of line per paragraph')->example('5 | 10 | ...')->validate()->ifTrue(function ($v) {
         return !is_integer($v);
     })->then(function ($v) {
         throw new EngineException('Numeric::maxlines must be and integer');
     })->end()->end()->scalarNode('minlines')->defaultValue(5)->info('Minimum number of lines per paragraph')->example('20 | 100 | ..')->validate()->ifTrue(function ($v) {
         return !is_integer($v);
     })->then(function ($v) {
         throw new EngineException('Numeric::minlines must be and integer');
     })->end()->end()->end();
     return $rootNode;
 }