ReadableFilePath   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 14 3
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2014-12-20 
5
 */
6
7
namespace Net\Bazzline\Component\Locator\Configuration\Validator;
8
9
/**
10
 * Class ReadableFilePath
11
 * @package Net\Bazzline\Component\Locator\Configuration\Validator
12
 */
13
class ReadableFilePath
14
{
15
    /**
16
     * @param string $path
17
     * @throws RuntimeException
18
     * @todo add interface
19
     * @todo replace RuntimeException with InvalidArgumentException
20
     */
21
    public function validate($path)
22
    {
23
        if (!is_file($path)) {
24
            throw new RuntimeException(
25
                'provided path "' . $path . '" is not a file'
26
            );
27
        }
28
29
        if (!is_readable($path)) {
30
            throw new RuntimeException(
31
                'file "' . $path . '" is not readable'
32
            );
33
        }
34
    }
35
}