DirectoryIsWritable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 15 4
1
<?php
2
namespace Health\Checks\Filesystem;
3
4
use Health\Checks\HealthCheckInterface;
5
use Health\Checks\BaseCheck;
6
7
class DirectoryIsWritable 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
        $paths = $this->getParam('paths', []);
20
21
        foreach ($paths as $path) {
22
            if (! is_dir($path) || ! is_writeable($path)) {
23
                $builder->down()->withData('path', $path);
24
            }
25
        }
26
27
        $builder->withData('paths', $paths);
28
29
        return $builder->build();
30
    }
31
}
32