Completed
Branch 2.0.0 (a6ce5f)
by Chubarov
06:30 queued 03:11
created

ConstructorUrl   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 31.58 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 12
loc 38
rs 10
c 1
b 0
f 1
wmc 4
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A concatenationUrlCurl() 0 11 3
A guid() 12 12 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
namespace agoalofalife\bpm\Assistants;
3
4
/**
5
 * Class ConstructorUrl
6
 *
7
 * @package agoalofalife\bpm\Assistants
8
 */
9
trait ConstructorUrl
10
{
11
    use VerifyValues;
12
    /**
13
     * Concatenation Url In Curl
14
     * @param $newParameters string
15
     * @return $this
16
     */
17
    protected function concatenationUrlCurl($newParameters)
18
    {
19
        if ($this->url  == '?') {
20
            $this->url .= $newParameters;
0 ignored issues
show
Bug introduced by
The property url does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
21
        } elseif ($this->url == '') {
22
            $this->url .= $newParameters;
23
        } else {
24
            $this->url .= '&'.$newParameters;
25
        }
26
        return $this;
27
    }
28
29
    /**
30
     * Contains guid
31
     * @param $guid
32
     * @return $this
33
     */
34 View Code Duplication
    public function guid($guid)
0 ignored issues
show
Duplication introduced by
This method 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...
35
    {
36
        $this->checkGuId($guid);
37
        $this->url      = '';
38
        $ParameterQuery = '(guid';
39
        $ParameterQuery.= "'";
40
        $ParameterQuery.= $guid;
41
        $ParameterQuery.= "'";
42
        $ParameterQuery.=')';
43
44
        return $this->concatenationUrlCurl($ParameterQuery);
45
    }
46
}