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

Affiliations   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A add() 0 9 3
1
<?php
2
3
namespace PubPeerFoundation\PublicationDataExtractor\Models;
4
5
class Affiliations extends Model
6
{
7
    /**
8
     * Hold cherry picked list of affiliations.
9
     *
10
     * @var array
11
     */
12
    protected $list = [];
13
14
    /**
15
     * Add unknown affiliations to the current list.
16
     *
17
     * @param $affiliations
18
     * @return array
19
     */
20
    public function add(array $affiliations): array
21
    {
22
        foreach ($affiliations as $affiliation) {
23
            if (! in_array(strtolower($affiliation['name']), $this->knownIdentifierValues('name'))) {
24
                $this->list[] = $affiliation;
25
            }
26
        }
27
28
        return $this->list;
29
    }
30
}
31