ArtLoader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A load() 0 8 1
A __construct() 0 10 1
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\Loader;
15
use holyshared\fixture\FixtureLoader;
16
use League\CLImate\CLImate;
17
use League\CLImate\Util\Output;
18
19
20
final class ArtLoader implements FixtureLoader
21
{
22
    const NAME = 'art';
23
24
    /**
25
     * @var \League\CLImate\CLImate
26
     */
27
    private $cli;
28
29
    /**
30
     * @var \League\CLImate\Util\Output
31
     */
32
    private $output;
33
34
    /**
35
     * @var \holyshared\fixture\Loader
36
     */
37
    private $loader;
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getName()
43
    {
44
        return static::NAME;
45
    }
46
47
    /**
48
     * Create a new art loader
49
     *
50
     * @param \holyshared\fixture\Loader
51
     */
52
    public function __construct(Loader $loader)
53
    {
54
        $this->output = new Output();
55
        $this->output->sameLine();
56
        $this->output->defaultTo('buffer');
57
58
        $this->cli = new CLImate();
59
        $this->cli->setOutput($this->output);
60
        $this->loader = $loader;
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function load($path, array $arguments = [])
67
    {
68
        $content = $this->loader->load($path, $arguments);
69
        $this->cli->out($content);
70
71
        $bufferWriter = $this->output->get('buffer');
72
        return $bufferWriter->get();
73
    }
74
75
}
76