GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Container::dump()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Ayaml;
3
4
use Ayaml\Fixture\AyamlSchemaNotFoundException;
5
use Ayaml\Fixture\YamlData;
6
7
/**
8
 * Class Container
9
 * @package Ayaml
10
 */
11
class Container
12
{
13
    /**
14
     * @var YamlData
15
     */
16
    private $yamlData;
17
18
    /**
19
     * @var null|array
20
     */
21
    private $resultData = null;
22
23
    /**
24
     * @param YamlData $yamlData
25
     */
26
    public function __construct(YamlData $yamlData)
27
    {
28
        $this->yamlData = $yamlData;
29
    }
30
31
    /**
32
     * @param string $name
33
     * @return $this
34
     * @throws AyamlSchemaNotFoundException
35
     */
36
    public function schema($name)
37
    {
38
        $this->resultData = $this->yamlData->getSchema($name);
39
40
        return $this;
41
    }
42
43
    /**
44
     * @param array $overwrites
45
     * @return $this
46
     * @throws AyamlNoExistingKeyException
47
     * @throws AyamlSchemaNotSpecifiedException
48
     */
49
    public function with(array $overwrites)
50
    {
51
        if (is_null($this->resultData)) {
52
            $message = 'you should set schema before "with". ex.) Ayaml::file("f")->schema("s")->with(["k" => "v"])->dump()';
53
            throw new AyamlSchemaNotSpecifiedException($message);
54
        }
55
        foreach ($overwrites as $overwriteKey => $overwriteVal) {
56
            if (! array_key_exists($overwriteKey, $this->resultData)) {
57
                throw new AyamlNoExistingKeyException("key: $overwriteKey does not exist.");
58
            }
59
            $this->resultData[$overwriteKey] = $overwriteVal;
60
        }
61
62
        return $this;
63
    }
64
65
    /**
66
     * @return array|null
67
     */
68
    public function dump()
69
    {
70
        return $this->resultData;
71
    }
72
}
73