Passed
Push — master ( e32a81...12baf4 )
by Antonio Carlos
02:26
created

src/Checkers/Artisan.php (2 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace PragmaRX\Health\Checkers;
4
5
use Illuminate\Support\Facades\Artisan as IlluminateArtisan;
6
7
class Artisan extends Base
8
{
9
    /**
10
     * Check resource.
11
     *
12
     * @return bool
13
     */
14 1
    public function check()
15
    {
16 1
        return $this->executeAndCheck()
17
            ? $this->makeHealthyResult()
18
            : $this->makeResult(false, $this->target->getErrorMessage());
19
    }
20
21
    /**
22
     * @return bool
23
     */
24 1
    protected function executeAndCheck()
25
    {
26 1
        $this->executeArtisan();
27
28
        return $this->checkArtisanOutput();
29
    }
30
31
    /**
32
     * @return bool
33
     */
34
    protected function checkArtisanOutput()
35
    {
36
        $output = IlluminateArtisan::output();
37
38
        return
39
            $output && preg_match("|{$this->target->shouldReturn}|", $output);
0 ignored issues
show
The property shouldReturn does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
40
    }
41
42 1
    protected function executeArtisan()
43
    {
44 1
        IlluminateArtisan::call(
45 1
            $this->target->command['name'],
0 ignored issues
show
The property command does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
46 1
            $this->target->command['options']->toArray()
47
        );
48
    }
49
}
50