1 | <?php |
||
12 | final class NoCandidateFoundException extends \Exception implements Exception |
||
13 | { |
||
14 | /** |
||
15 | * @param string $strategy |
||
16 | * @param array $candidates |
||
17 | */ |
||
18 | 7 | public function __construct($strategy, array $candidates) |
|
19 | { |
||
20 | 7 | $classes = array_map( |
|
21 | 7 | function ($a) { |
|
22 | return $a['class']; |
||
23 | 7 | }, |
|
24 | 7 | $candidates |
|
25 | ); |
||
26 | |||
27 | 7 | $message = sprintf( |
|
28 | 7 | 'No valid candidate found using strategy "%s". We tested the following candidates: %s.', |
|
29 | 7 | $strategy, |
|
30 | 7 | implode(', ', array_map([$this, 'stringify'], $classes)) |
|
31 | ); |
||
32 | |||
33 | 7 | parent::__construct($message); |
|
34 | 7 | } |
|
35 | |||
36 | private function stringify($mixed) |
||
48 | } |
||
49 |