Test Failed
Push — master ( e0bb23...a0e316 )
by Antonio Carlos
31:20
created

src/Checkers/CloudStorage.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 Storage;
6
use PragmaRX\Health\Support\Result;
7
8
class CloudStorage extends Base
9
{
10
    /**
11
     * @return Result
12
     */
13
    public function check()
14
    {
15
        try {
16
            Storage::disk($this->target->driver)->put(
0 ignored issues
show
The property driver 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
                $this->target->file,
0 ignored issues
show
The property file 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...
18
                $this->target->contents
0 ignored issues
show
The property contents 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...
19
            );
20
21
            $contents = Storage::disk($this->target->driver)->get(
22
                $this->target->file
23
            );
24
25
            Storage::disk($this->target->driver)->delete($this->target->file);
26
27
            if ($contents !== $this->target->contents) {
28
                return $this->makeResult(
29
                    false,
30
                    $this->target->getErrorMessage()
31
                );
32
            }
33
34
            return $this->makeHealthyResult();
35
        } catch (\Exception $exception) {
36
            report($exception);
37
38
            return $this->makeResultFromException($exception);
39
        }
40
    }
41
}
42