TextLoader::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
/**
4
 * This file is part of file-fixture.
5
 *
6
 * (c) Noritaka Horio <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace holyshared\fixture\loader;
13
14
use holyshared\fixture\FixtureLoader;
15
16
17
final class TextLoader implements FixtureLoader
18
{
19
20
    const NAME = 'text';
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getName()
26
    {
27
        return static::NAME;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function load($path, array $arguments = [])
34
    {
35
        if (file_exists($path) === false) {
36
            throw new FixtureFileNotFoundException($path);
37
        }
38
        $content = file_get_contents($path);
39
40
        return rtrim($content);
41
    }
42
43
}
44