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

ResourcesListResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 44
loc 44
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 2
A getResponseContext() 4 4 1
A getResources() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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