1 | <?php |
||
15 | class ReporterFactory |
||
16 | { |
||
17 | use HasEventEmitterTrait; |
||
18 | |||
19 | /** |
||
20 | * @var \Peridot\Configuration |
||
21 | */ |
||
22 | protected $configuration; |
||
23 | |||
24 | /** |
||
25 | * @var \Peridot\Runner\Runner |
||
26 | */ |
||
27 | protected $runner; |
||
28 | |||
29 | /** |
||
30 | * @var \Symfony\Component\Console\Output\OutputInterface |
||
31 | */ |
||
32 | protected $output; |
||
33 | |||
34 | /** |
||
35 | * Registered reporters |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $reporters = array( |
||
40 | 'spec' => ['description' => 'hierarchical spec list', 'factory' => 'Peridot\Reporter\SpecReporter'] |
||
41 | ); |
||
42 | |||
43 | /** |
||
44 | * @param Configuration $configuration |
||
45 | * @param OutputInterface $output |
||
46 | * @param EventEmitterInterface $eventEmitter |
||
47 | */ |
||
48 | public function __construct( |
||
57 | |||
58 | /** |
||
59 | * Return an instance of the named reporter |
||
60 | * |
||
61 | * @param $name |
||
62 | * @return \Peridot\Reporter\AbstractBaseReporter |
||
63 | */ |
||
64 | public function create($name) |
||
68 | |||
69 | /** |
||
70 | * Return an instance of the named reporter |
||
71 | * |
||
72 | * @param $name |
||
73 | * @return \Peridot\Reporter\AbstractBaseReporter |
||
74 | */ |
||
75 | public function createComposite(array $names) |
||
93 | |||
94 | /** |
||
95 | * Return the factory defined for the named reporter |
||
96 | * |
||
97 | * @param string $name |
||
98 | * @return null|string|callable |
||
99 | */ |
||
100 | public function getReporterFactory($name) |
||
108 | |||
109 | /** |
||
110 | * Return the definition of the named reporter |
||
111 | * |
||
112 | * @param string $name |
||
113 | * @return array |
||
114 | */ |
||
115 | public function getReporterDefinition($name) |
||
123 | |||
124 | /** |
||
125 | * Register a named reporter with the factory. |
||
126 | * |
||
127 | * @param string $name |
||
128 | * @param string $description |
||
129 | * @param string $factory Either a callable or a fully qualified class name |
||
130 | */ |
||
131 | public function register($name, $description, $factory) |
||
135 | |||
136 | /** |
||
137 | * @return array |
||
138 | */ |
||
139 | public function getReporters() |
||
143 | |||
144 | private function createWithOutput(OutputInterface $output, $name) |
||
159 | } |
||
160 |