Completed
Push — master ( 69b436...e84470 )
by Kirill
14:54 queued 05:27
created

Offset   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 32
loc 32
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A getField() 4 4 1
A getOffset() 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
 * This file is part of Hydrogen package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace RDS\Hydrogen\Criteria;
11
12
use RDS\Hydrogen\Criteria\Common\Field;
13
14
/**
15
 * Class Offset
16
 */
17 View Code Duplication
class Offset extends Criterion
0 ignored issues
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...
18
{
19
    /**
20
     * @var int
21
     */
22
    private $offset;
23
24
    /**
25
     * Offset constructor.
26
     * @param int $offset
27
     */
28 2
    public function __construct(int $offset)
29
    {
30 2
        $this->offset = $offset;
31 2
    }
32
33
    /**
34
     * @return Field
35
     */
36
    public function getField(): Field
37
    {
38
        throw new \LogicException(\sprintf('Criterion %s does not provide the field', \class_basename($this)));
39
    }
40
41
    /**
42
     * @return int
43
     */
44 2
    public function getOffset(): int
45
    {
46 2
        return $this->offset;
47
    }
48
}
49