Conditions | 2 |
Paths | 2 |
Total Lines | 38 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public function __construct(array $config) |
||
39 | { |
||
40 | $resolver = new OptionsResolver(); |
||
41 | $resolver->setDefaults( |
||
42 | [ |
||
43 | 'metric_uuid' => null, |
||
44 | 'service_uuid' => null, |
||
45 | 'validator' => [], |
||
46 | ] |
||
47 | ); |
||
48 | |||
49 | $resolver->setRequired( |
||
50 | [ |
||
51 | 'url', |
||
52 | 'method', |
||
53 | 'headers', |
||
54 | 'timeout', |
||
55 | 'status_code', |
||
56 | ] |
||
57 | ); |
||
58 | |||
59 | foreach ($config['urls'] as $name => $attribute) { |
||
60 | $attribute = $resolver->resolve($attribute); |
||
61 | $this->urls[$name] = new UrlInfo( |
||
62 | $name, |
||
63 | $attribute['url'], |
||
64 | $attribute['method'], |
||
65 | $attribute['headers'], |
||
66 | $attribute['timeout'], |
||
67 | $attribute['status_code'], |
||
68 | (new Validator( |
||
69 | $attribute['validator'] |
||
70 | )), |
||
71 | $attribute['metric_uuid'], |
||
72 | $attribute['service_uuid'] |
||
73 | ); |
||
74 | } |
||
75 | } |
||
76 | |||
87 |