AbstractLoader::load()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 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