Completed
Pull Request — master (#43)
by Jose Manuel
02:54
created

Collection::add()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.9332
c 0
b 0
f 0
cc 4
nc 3
nop 1
crap 4
1
<?php
2
3
namespace Softonic\GraphQL\DataObjects\Mutation;
4
5
class Collection extends FilteredCollection
6
{
7 16
    public function add(array $itemData): void
8
    {
9 16
        if (!empty($this->arguments[0]) && $this->arguments[0] instanceof Collection) {
10 8
            foreach ($this->arguments as $argument) {
11 8
                $argument->add($itemData);
12
            }
13
        } else {
14 16
            $this->arguments[] = new Item($itemData, $this->config, true);
15
        }
16 16
    }
17
}
18