Test Failed
Push — master ( 8a7ae2...79eb97 )
by Chris
06:09
created

AbstractInlineAssetBuilder::getConstraints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Leonidas\Library\Core\Asset;
4
5
use Leonidas\Contracts\Http\ServerRequestPolicyInterface;
6
7
abstract class AbstractInlineAssetBuilder
8
{
9
    protected string $handle;
10
11
    protected string $code;
12
13
    protected ?ServerRequestPolicyInterface $policy = null;
14
15
    public function __construct(string $handle)
16
    {
17
        $this->handle = $handle;
18
    }
19
20
    public function handle(string $handle): AbstractInlineAssetBuilder
21
    {
22
        return $this->handle = $handle;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->handle = $handle returns the type string which is incompatible with the type-hinted return Leonidas\Library\Core\As...tractInlineAssetBuilder.
Loading history...
23
24
        return $this;
0 ignored issues
show
Unused Code introduced by
return $this is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
25
    }
26
27
    public function getHandle(): string
28
    {
29
        return $this->handle;
30
    }
31
32
    public function code(string $code): AbstractInlineAssetBuilder
33
    {
34
        $this->code = $code;
35
36
        return $this;
37
    }
38
39
    public function getCode(): string
40
    {
41
        return $this->code;
42
    }
43
44
    public function policy(?ServerRequestPolicyInterface $policy): AbstractInlineAssetBuilder
45
    {
46
        $this->policy = $policy;
47
48
        return $this;
49
    }
50
51
    public function getPolicy(): ?ServerRequestPolicyInterface
52
    {
53
        return $this->policy;
54
    }
55
}
56