Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • ArrayNodeDefinition
  • BooleanNodeDefinition
  • EnumNodeDefinition
  • ExprBuilder
  • FloatNodeDefinition
  • IntegerNodeDefinition
  • MergeBuilder
  • NodeBuilder
  • NodeDefinition
  • NormalizationBuilder
  • NumericNodeDefinition
  • ScalarNodeDefinition
  • TreeBuilder
  • ValidationBuilder
  • VariableNodeDefinition

Interfaces

  • NodeParentInterface
  • ParentNodeDefinitionInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Symfony\Component\Config\Definition\Builder;
 4: 
 5: use Symfony\Component\Config\Definition\EnumNode;
 6: use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
 7: 
 8: /**
 9:  * Enum Node Definition.
10:  *
11:  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
12:  */
13: class EnumNodeDefinition extends ScalarNodeDefinition
14: {
15:     private $values;
16: 
17:     public function values(array $values)
18:     {
19:         $values = array_unique($values);
20: 
21:         if (count($values) <= 1) {
22:             throw new \InvalidArgumentException('->values() must be called with at least two distinct values.');
23:         }
24: 
25:         $this->values = $values;
26: 
27:         return $this;
28:     }
29: 
30:     /**
31:      * Instantiate a Node
32:      *
33:      * @return EnumNode The node
34:      *
35:      * @throws \RuntimeException
36:      */
37:     protected function instantiateNode()
38:     {
39:         if (null === $this->values) {
40:             throw new \RuntimeException('You must call ->values() on enum nodes.');
41:         }
42: 
43:         return new EnumNode($this->name, $this->parent, $this->values);
44:     }
45: }
46: 
php-coveralls API documentation generated by ApiGen 2.8.0