| Total Complexity | 8 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class Links extends Model |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Hold cherry picked list of links. |
||
| 9 | * |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $list = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Add unknown links to the current list. |
||
| 16 | */ |
||
| 17 | public function add(array $links): array |
||
| 18 | { |
||
| 19 | foreach ($links as $link) { |
||
| 20 | if ($this->hasPreprint($link)) { |
||
| 21 | $this->list[] = $link; |
||
| 22 | } |
||
| 23 | if ($this->isPreprint($link)) { |
||
| 24 | $this->list[] = $link; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | return $this->list; |
||
| 29 | } |
||
| 30 | |||
| 31 | private function hasPreprint(array $link): bool |
||
| 38 | } |
||
| 39 | |||
| 40 | private function isPreprint(array $link): bool |
||
| 49 |