GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

KeywordsFieldMapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSupportedFields() 0 6 1
A mapField() 0 18 3
1
<?php
2
/**
3
 * Mapper for mapping data between raw input and Keyword VO's
4
 *
5
 * @link        http://github.com/PHPExif/php-exif-native for the canonical source repository
6
 * @title   Title (c) 2016 Tom Van Herreweghe <[email protected]>
7
 * @license     http://github.com/PHPExif/php-exif-native/blob/master/LICENSE MIT License
8
 * @category    PHPExif
9
 * @package     Native
10
 */
11
12
namespace PHPExif\Adapter\Native\Reader\Mapper\Iptc;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use PHPExif\Common\Data\IptcInterface;
16
use PHPExif\Common\Data\ValueObject\Keyword;
17
use PHPExif\Common\Mapper\FieldMapper;
18
use PHPExif\Common\Mapper\GuardInvalidArgumentsForIptcTrait;
19
20
/**
21
 * Mapper
22
 *
23
 * @category    PHPExif
24
 * @package     Native
25
 */
26
class KeywordsFieldMapper implements FieldMapper
27
{
28
    use GuardInvalidArgumentsForIptcTrait;
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    public function getSupportedFields()
34
    {
35
        return array(
36
            Keyword::class,
37
        );
38
    }
39
40
    /**
41
     * {@inheritDoc}
42
     */
43
    public function mapField($field, array $input, &$output)
44
    {
45
        $this->guardInvalidArguments($field, $input, $output);
46
47
        if (!array_key_exists('2#025', $input)) {
48
            return;
49
        }
50
51
        $collection = new ArrayCollection;
52
53
        foreach ($input['2#025'] as $keywordData) {
54
            $collection->add(
55
                new Keyword($keywordData)
56
            );
57
        }
58
59
        $output = $output->withKeywords($collection);
60
    }
61
}
62