FileIsReadable::call()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
rs 10
cc 4
nc 3
nop 0
1
<?php
2
namespace Health\Checks\Filesystem;
3
4
use Health\Checks\HealthCheckInterface;
5
use Health\Checks\BaseCheck;
6
7
class FileIsReadable extends BaseCheck implements HealthCheckInterface
8
{
9
10
    /**
11
     *
12
     * {@inheritdoc}
13
     * @see \Health\Checks\HealthCheckInterface::call()
14
     */
15
    public function call()
16
    {
17
        $builder = $this->getBuilder();
18
19
        $files = $this->getParam('files', []);
20
21
        foreach ($files as $file) {
22
            if (! is_file($file) || ! is_readable($file)) {
23
                $builder->down()->withData('file', $file);
24
            }
25
        }
26
27
        $builder->withData('files', $files);
28
29
        return $builder->build();
30
    }
31
}
32