Completed
Push — master ( 109000...79dd3c )
by Paweł
02:28 queued 02:24
created

Rollup   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 20
loc 20
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupByPart() 4 4 1
A __construct() 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
namespace Xsolve\SalesforceClient\QueryBuilder\Expr\GroupBy;
4
5
use Xsolve\SalesforceClient\QueryBuilder\Expr\ExprInterface;
6
7 View Code Duplication
class Rollup extends AbstractGroupBy implements ExprInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $fields;
13
14 1
    public function __construct(array $fields)
15
    {
16 1
        $this->fields = $fields;
17 1
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 1
    protected function getGroupByPart(): string
23
    {
24 1
        return sprintf('ROLLUP(%s)', implode(', ', $this->fields));
25
    }
26
}
27