Conditions | 5 |
Paths | 6 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function handle() |
||
15 | { |
||
16 | $url = Url::fromString($this->argument('url')); |
||
|
|||
17 | |||
18 | if (! in_array($url->getScheme(), ['http', 'https'])) { |
||
19 | if ($scheme = $this->choice("Which protocol needs to be used for checking `{$url}`?", [1 => 'https', 2 => 'http'], 1)) { |
||
20 | $url = $url->withScheme($scheme); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | if ($this->confirm('Should we look for a specific string on the response?')) { |
||
25 | $lookForString = $this->ask('Which string?'); |
||
26 | } |
||
27 | |||
28 | $monitor = Monitor::create([ |
||
29 | 'url' => trim($url, '/'), |
||
30 | 'look_for_string' => $lookForString ?? '', |
||
31 | 'uptime_check_method' => isset($lookForString) ? 'get' : 'head', |
||
32 | 'certificate_check_enabled' => $url->getScheme() === 'https', |
||
33 | 'uptime_check_interval_in_minutes' => config('uptime-monitor.uptime_check.run_interval_in_minutes'), |
||
34 | ]); |
||
35 | |||
36 | $this->warn("{$monitor->url} will be monitored!"); |
||
37 | } |
||
38 | } |
||
39 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.