Passed
Push — master ( c3bafb...29fa5f )
by Xavier
02:01
created

Identifiers::add()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 4
nc 3
nop 1
1
<?php
2
3
namespace PubPeerFoundation\PublicationDataExtractor\Models;
4
5
class Identifiers extends Model
6
{
7
    /**
8
     * Hold cherry picked list of identifiers.
9
     *
10
     * @var array
11
     */
12
    protected $list = [];
13
14
    /**
15
     * Add unknown identifiers to the current list.
16
     *
17
     * @param $identifiers
18
     * @return array
19
     */
20
    public function add(array $identifiers): array
21
    {
22
        foreach ($identifiers as $identifier) {
23
            if (! in_array(strtolower($identifier['value']), $this->knownIdentifierValues('value'))) {
24
                $this->list[] = $identifier;
25
            }
26
        }
27
28
        return $this->list;
29
    }
30
}
31