Test Failed
Push — master ( bfe357...41d8e8 )
by Antonio Carlos
25:24
created

src/Checkers/DiskSpace.php (3 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 PragmaRX\Health\Support\Result;
6
7
class DiskSpace extends Base
8
{
9
    /**
10
     * Check resource.
11
     *
12
     * @return Result
13
     */
14
    public function check()
15
    {
16
        $free = disk_free_space($this->target->path);
0 ignored issues
show
The property path 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...
17
18
        if (!$this->isEnough($free, $this->target->minimum)) {
19
            return $this->makeResult(
20
                false,
21
                sprintf(
22
                    $this->target->message,
0 ignored issues
show
The property message 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...
23
                    $this->target->path,
24
                    bytes_to_human($free),
25
                    $this->target->minimum
0 ignored issues
show
The property minimum 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...
26
                )
27
            );
28
        }
29
30
        return $this->makeHealthyResult();
31
    }
32
33
    public function isEnough($free, $minimum)
34
    {
35
        return $free > human_to_bytes($minimum);
36
    }
37
}
38