Test Failed
Push — master ( bfe357...41d8e8 )
by Antonio Carlos
25:24
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
    public function check()
15
    {
16
        return $this->executeAndCheck()
17
            ? $this->makeHealthyResult()
18
            : $this->makeResult(false, $this->target->getErrorMessage());
19
    }
20
21
    /**
22
     * @return bool
23
     */
24
    protected function executeAndCheck(): bool
25
    {
26
        $this->executeArtisan();
27
28
        return $this->checkArtisanOutput();
29
    }
30
31
    /**
32
     * @return bool
33
     */
34
    protected function checkArtisanOutput(): bool
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
43
    protected function executeArtisan(): void
44
    {
45
        IlluminateArtisan::call(
46
            $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...
47
            $this->target->command['options']->toArray()
48
        );
49
    }
50
}
51