Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#709)
by Timur
07:03
created

Argument::offsetSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Definition;
6
7
use function count;
8
use function sprintf;
9
use function trigger_error;
10
use const E_USER_DEPRECATED;
11
12
class Argument implements ArgumentInterface
13
{
14
    private array $rawArguments = [];
15
16 105
    public function __construct(array $rawArguments = null)
17
    {
18 105
        $this->exchangeArray($rawArguments);
19 105
    }
20
21 105
    public function exchangeArray(array $array = null): array
22
    {
23 105
        $old = $this->rawArguments;
24 105
        $this->rawArguments = $array ?? [];
25
26 105
        return $old;
27
    }
28
29 47
    public function getArrayCopy(): array
30
    {
31 47
        return $this->rawArguments;
32
    }
33
34
    /**
35
     * @deprecated This method is deprecated since 0.12 and will be removed in 0.13. You should use getArrayCopy method instead.
36
     */
37 1
    public function getRawArguments(): array
38
    {
39 1
        @trigger_error(
40 1
            sprintf(
41
                'This "%s" method is deprecated since 0.12 and will be removed in 0.13. You should use "%s::getArrayCopy" instead.',
42
                __METHOD__,
43 1
                __CLASS__
44
            ),
45 1
            E_USER_DEPRECATED
46
        );
47
48 1
        return $this->getArrayCopy();
49
    }
50
51
    /**
52
     * @param int|string $offset
53
     */
54 58
    public function offsetExists($offset): bool
55
    {
56 58
        return isset($this->rawArguments[$offset]);
57
    }
58
59
    /**
60
     * @param int|string $offset
61
     *
62
     * @return mixed|null
63
     */
64 56
    public function offsetGet($offset)
65
    {
66 56
        return $this->offsetExists($offset) ? $this->rawArguments[$offset] : null;
67
    }
68
69
    /**
70
     * @param int|string $offset
71
     * @param mixed      $value
72
     */
73 1
    public function offsetSet($offset, $value): void
74
    {
75 1
        $this->rawArguments[$offset] = $value;
76 1
    }
77
78
    /**
79
     * @param int|string $offset
80
     */
81 1
    public function offsetUnset($offset): void
82
    {
83 1
        unset($this->rawArguments[$offset]);
84 1
    }
85
86 1
    public function count(): int
87
    {
88 1
        return count($this->rawArguments);
89
    }
90
91
    /**
92
     * @return mixed
93
     */
94 2
    public function __get(string $name)
95
    {
96 2
        return $this->rawArguments[$name] ?? null;
97
    }
98
}
99