Passed
Pull Request — master (#1)
by Peter
07:07
created

FooBarStub   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 81
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setFoo() 0 5 1
A getId() 0 3 1
A __toString() 0 3 1
A setId() 0 3 1
A getBar() 0 3 1
A toJSON() 0 6 1
A getFoo() 0 3 1
A setBar() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\TestDouble\Domain\Entity;
6
7
use AbterPhp\Framework\Domain\Entities\IStringerEntity;
8
9
abstract class FooBarStub implements IStringerEntity
10
{
11
    /** @var string */
12
    protected $foo;
13
14
    /** @var string */
15
    protected $bar;
16
17
    /**
18
     * @return string
19
     */
20
    public function getId()
21
    {
22
        return $this->foo;
23
    }
24
25
    /**
26
     * @param string $id
27
     */
28
    public function setId($id)
29
    {
30
        $this->id = $id;
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getFoo(): string
37
    {
38
        return $this->foo;
39
    }
40
41
    /**
42
     * @param string $foo
43
     *
44
     * @return $this
45
     */
46
    public function setFoo(string $foo): self
47
    {
48
        $this->foo = $foo;
49
50
        return $this;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getBar(): string
57
    {
58
        return $this->bar;
59
    }
60
61
    /**
62
     * @param string $bar
63
     *
64
     * @return $this
65
     */
66
    public function setBar(string $bar): self
67
    {
68
        $this->bar = $bar;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function __toString(): string
77
    {
78
        return $this->foo;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function toJSON(): string
85
    {
86
        return json_encode(
87
            [
88
                'foo' => $this->getFoo(),
89
                'bar' => $this->getBar(),
90
            ]
91
        );
92
    }
93
}
94