1 | <?php |
||
14 | class DefaultMarkupReporter extends Component implements MarkupReporterInterface |
||
15 | { |
||
16 | const ERRORS_NUMBER_THRESHOLD_KEY = 'errorsNumberThreshold'; |
||
17 | |||
18 | const IGNORE_WARNINGS_CONFIG_KEY = 'ignoreWarnings'; |
||
19 | |||
20 | const IGNORED_ERRORS_CONFIG_KEY = 'ignoredErrors'; |
||
21 | |||
22 | /** |
||
23 | * Use asserts to report messages. |
||
24 | */ |
||
25 | use Asserts; |
||
26 | |||
27 | /** |
||
28 | * Configuration parameters. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $configuration = array( |
||
33 | self::ERRORS_NUMBER_THRESHOLD_KEY => 0, |
||
34 | self::IGNORE_WARNINGS_CONFIG_KEY => true, |
||
35 | self::IGNORED_ERRORS_CONFIG_KEY => array(), |
||
36 | ); |
||
37 | |||
38 | /** |
||
39 | * {@inheritDoc} |
||
40 | */ |
||
41 | public function __construct(array $configuration = array()) |
||
45 | |||
46 | /** |
||
47 | * {@inheritDoc} |
||
48 | */ |
||
49 | public function report(array $messages) |
||
60 | |||
61 | /** |
||
62 | * Filters messages to report. |
||
63 | * |
||
64 | * @param array $messages Messages to filter. |
||
65 | * |
||
66 | * @return array Filtered messages. |
||
67 | */ |
||
68 | private function filterMesages(array $messages) |
||
97 | |||
98 | /** |
||
99 | * Returns a boolean indicating whether messages number |
||
100 | * is below the threshold or not. |
||
101 | * |
||
102 | * @param array $messages Messages to report about. |
||
103 | * |
||
104 | * @return boolean Whether errors number is below the threshold or not. |
||
105 | */ |
||
106 | private function belowThreshold(array $messages) |
||
117 | |||
118 | /** |
||
119 | * Returns a boolean indicating whether the reporter ignores warnings or not. |
||
120 | * |
||
121 | * @return bool Whether the reporter ignores warnings or not. |
||
122 | */ |
||
123 | private function ignoreWarnings() |
||
134 | |||
135 | /** |
||
136 | * Returns a boolean indicating whether an error is ignored or not. |
||
137 | * |
||
138 | * @param string|null $summary Error summary. |
||
139 | * @return boolean Whether an error is ignored or not. |
||
140 | */ |
||
141 | private function ignoreError($summary) |
||
164 | } |
||
165 |