AbstractLoader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validatePath() 0 16 3
load() 0 1 ?
1
<?php
2
3
namespace Assimtech\Tempo\Loader;
4
5
use RuntimeException;
6
7
abstract class AbstractLoader
8
{
9
    /**
10
     * @param string $path
11
     * @throws \RuntimeException
12
     */
13 7
    protected function validatePath($path)
14
    {
15 7
        if (!is_string($path)) {
16 2
            throw new RuntimeException(sprintf(
17 2
                '$path must be a string (%s given)',
18 2
                gettype($path)
19 2
            ));
20
        }
21
22 5
        if (!file_exists($path)) {
23 2
            throw new RuntimeException(sprintf(
24 2
                'File not found: %s',
25
                $path
26 2
            ));
27
        }
28 3
    }
29
30
    /**
31
     * @param string $path
32
     * @return mixed
33
     */
34
    abstract public function load($path);
35
}
36