1 | <?php |
||
10 | class ExampleFactory |
||
11 | { |
||
12 | /** |
||
13 | * @var ExpectationFactory |
||
14 | */ |
||
15 | private $expectationFactory; |
||
16 | |||
17 | public function __construct(ExpectationFactory $expectationFactory = null) |
||
21 | |||
22 | /** |
||
23 | * Create examples from definitions |
||
24 | * |
||
25 | * @param array $defenitions Example definitions as created by Parser |
||
26 | * @return Example[] |
||
27 | */ |
||
28 | public function createExamples(array $defenitions) |
||
74 | |||
75 | /** |
||
76 | * Read the first argument from annotation $needle |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | private function readAnnotation($needle, array $annotations) |
||
81 | { |
||
82 | foreach ($annotations as list($name, $args)) { |
||
83 | if (strcasecmp($name, $needle) == 0) { |
||
84 | return isset($args[0]) ? $args[0] : ''; |
||
85 | } |
||
86 | } |
||
87 | |||
88 | return ''; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Check if this example is marked as ignored |
||
93 | * |
||
94 | * @return boolean |
||
95 | */ |
||
96 | private function shouldIgnoreExample(array $annotations) |
||
106 | |||
107 | /** |
||
108 | * Create expectation from definition data |
||
109 | * |
||
110 | * @return Expectation\ExpectationInterface[] |
||
111 | */ |
||
112 | private function createExpectations(array $annotations) |
||
122 | } |
||
123 |