ManifestChain   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 45
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addManifest() 0 6 1
A getManifests() 0 4 1
A getManifest() 0 6 2
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Manifest;
11
12
/**
13
 * Manifest chain used in console commands.
14
 */
15
class ManifestChain
16
{
17
    /**
18
     * @var array Manifest collection
19
     */
20
    protected $manifests = array();
21
22
    /**
23
     * Adds manifest to chain.
24
     *
25
     * @param ManifestInterface $manifest
26
     *
27
     * @return $this
28
     */
29 1
    public function addManifest(ManifestInterface $manifest)
30
    {
31 1
        $this->manifests[$manifest->getName()] = $manifest;
32
33 1
        return $this;
34
    }
35
36
    /**
37
     * Returns registered manifests.
38
     *
39
     * @return array Manifest collection
40
     */
41 2
    public function getManifests()
42
    {
43 2
        return $this->manifests;
44
    }
45
46
    /**
47
     * Finds a manifest by name.
48
     *
49
     * @param string $name Manifest name
50
     *
51
     * @return ManifestInterface
52
     */
53 1
    public function getManifest($name)
54
    {
55 1
        if (array_key_exists($name, $this->manifests)) {
56 1
            return $this->manifests[$name];
57
        }
58 1
    }
59
}
60