@@ 62-77 (lines=16) @@ | ||
59 | * |
|
60 | * @throws \Rehmatworks\laravelcdn\Exceptions\MissingConfigurationException |
|
61 | */ |
|
62 | public function validate($configuration, $required) |
|
63 | { |
|
64 | // search for any null or empty field to throw an exception |
|
65 | $missing = ''; |
|
66 | foreach ($configuration as $key => $value) { |
|
67 | if (in_array($key, $required) && |
|
68 | (empty($value) || $value == null || $value == '') |
|
69 | ) { |
|
70 | $missing .= ' '.$key; |
|
71 | } |
|
72 | } |
|
73 | ||
74 | if ($missing) { |
|
75 | throw new MissingConfigurationException('Missed Configuration:'.$missing); |
|
76 | } |
|
77 | } |
|
78 | ||
79 | /** |
|
80 | * Take url as string and return it parsed object. |
@@ 25-40 (lines=16) @@ | ||
22 | * |
|
23 | * @throws \Rehmatworks\laravelcdn\Exceptions\MissingConfigurationException |
|
24 | */ |
|
25 | public function validate($configuration, $required) |
|
26 | { |
|
27 | // search for any null or empty field to throw an exception |
|
28 | $missing = ''; |
|
29 | foreach ($configuration as $key => $value) { |
|
30 | if (in_array($key, $required) && |
|
31 | (empty($value) || $value == null || $value == '') |
|
32 | ) { |
|
33 | $missing .= ' '.$key; |
|
34 | } |
|
35 | } |
|
36 | ||
37 | if ($missing) { |
|
38 | throw new MissingConfigurationException('Missed Configuration:'.$missing); |
|
39 | } |
|
40 | } |
|
41 | } |
|
42 |