Completed
Push — master ( e41c6a...6a7f08 )
by Saurabh
03:07
created

UrlTransformer::transformUrl()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3.1406

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 2
dl 0
loc 8
ccs 3
cts 4
cp 0.75
crap 3.1406
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Sausin\Signere;
4
5
trait UrlTransformer
6
{
7
    /**
8
     * Adjust the URL to production or test environment.
9
     *
10
     * @param  string $url
11
     * @param  string $prefix
12
     * @return string
13
     */
14 63
    protected function transformUrl(string $url, string $prefix = 'test')
15
    {
16 63
        if ($this->environment === 'test' || $this->environment === 'local') {
0 ignored issues
show
Bug introduced by
The property environment 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...
17
            return http_build_url($url, $prefix.parse_url($url)['host']);
18
        }
19
20 63
        return $url;
21
    }
22
}
23