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.

LinksFactory::create()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 7
nc 3
nop 2
1
<?php
2
3
namespace Hateoas\Factory;
4
5
use Hateoas\Configuration\RelationsRepository;
6
use Hateoas\Model\Link;
7
use Hateoas\Serializer\ExclusionManager;
8
use JMS\Serializer\SerializationContext;
9
10
/**
11
 * @author Adrien Brault <[email protected]>
12
 */
13
class LinksFactory
14
{
15
    /**
16
     * @var RelationsRepository
17
     */
18
    private $relationsRepository;
19
20
    /**
21
     * @var LinkFactory
22
     */
23
    private $linkFactory;
24
25
    /**
26
     * @var ExclusionManager
27
     */
28
    private $exclusionManager;
29
30
    /**
31
     * @param RelationsRepository $relationsRepository
32
     * @param LinkFactory         $linkFactory
33
     * @param ExclusionManager    $exclusionManager
34
     */
35
    public function __construct(RelationsRepository $relationsRepository, LinkFactory $linkFactory, ExclusionManager $exclusionManager)
36
    {
37
        $this->relationsRepository = $relationsRepository;
38
        $this->linkFactory         = $linkFactory;
39
        $this->exclusionManager    = $exclusionManager;
40
    }
41
42
    /**
43
     * @param object               $object
44
     * @param SerializationContext $context
45
     *
46
     * @return Link[]
47
     */
48
    public function create($object, SerializationContext $context)
49
    {
50
        $links = array();
51
        foreach ($this->relationsRepository->getRelations($object) as $relation) {
52
            if ($this->exclusionManager->shouldSkipLink($object, $relation, $context)) {
53
                continue;
54
            }
55
56
            $links[] = $this->linkFactory->createLink($object, $relation);
57
        }
58
59
        return $links;
60
    }
61
}
62