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.

Code

< 40 %
40-60 %
> 60 %
1
<?php
2
3
namespace Funstaff\RefLibRis;
4
5
/**
6
 * RisFieldsMapping
7
 *
8
 * @author Bertrand Zuchuat <[email protected]>
9
 */
10
class RisFieldsMapping implements RisFieldsMappingInterface
11
{
12
    /**
13
     * @var array
14
     */
15
    private $mapping;
16
17
    /**
18
     * RisMapping constructor.
19
     * @param array $mapping
20
     */
21
    public function __construct(array $mapping)
22
    {
23
        $this->mapping = $mapping;
24
    }
25
26
    /**
27
     * @param string $field
28
     * @return null|string
29
     */
30
    public function findRisFieldByFieldName(string $field)
31
    {
32
        return $this->arrayFind($field);
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function getAllRisFields()
39
    {
40
        return array_keys($this->mapping);
41
    }
42
43
    /**
44
     * @param string $value
45
     * @return null|string
46
     */
47
    private function arrayFind(string $value)
48
    {
49
        $tag = null;
50
        foreach ($this->mapping as $key => $fields) {
51
            if (in_array($value, $fields)) {
52
                $tag = (string) $key;
53
                break;
54
            }
55
        }
56
57
        return $tag;
58
    }
59
}
60