Completed
Push — master ( f93802...a3beff )
by Paweł
34:14
created

ResourcesListResponse::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Core Bundle.
7
 *
8
 * Copyright 2016 Sourcefabric z.u. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2016 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Component\Common\Response;
18
19 View Code Duplication
final class ResourcesListResponse implements ResourcesListResponseInterface
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    /**
22
     * @var ResponseContext
23
     */
24
    private $responseContext;
25
26
    /**
27
     * @var mixed
28
     */
29
    private $resources;
30
31
    /**
32
     * ResourcesListResponse constructor.
33
     *
34
     * @param mixed           $resources
35
     * @param ResponseContext $responseContext
36
     */
37 11
    public function __construct($resources, ResponseContext $responseContext = null)
38
    {
39 11
        if (null === $responseContext) {
40 10
            $responseContext = new ResponseContext();
41
        }
42
43 11
        $this->responseContext = $responseContext;
44 11
        $this->resources = $resources;
45 11
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 9
    public function getResponseContext(): ResponseContext
51
    {
52 9
        return $this->responseContext;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58 9
    public function getResources()
59
    {
60 9
        return $this->resources;
61
    }
62
}
63