Total Complexity | 5 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class Article |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $body = ''; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $title = ''; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $link = ''; |
||
27 | |||
28 | /** |
||
29 | * Initializes the article instance. |
||
30 | * |
||
31 | * @param string $title |
||
32 | * @param string $body |
||
33 | * @param string|null $link |
||
34 | */ |
||
35 | 24 | public function __construct($title, $body, $link = null) |
|
36 | { |
||
37 | 24 | $this->body = $body; |
|
38 | |||
39 | 24 | $this->title = $title; |
|
40 | |||
41 | 24 | $this->link = $link; |
|
42 | 24 | } |
|
43 | |||
44 | /** |
||
45 | * Returns the body content. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 6 | public function body() |
|
50 | { |
||
51 | 6 | return $this->body; |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * Returns the source link. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | 3 | public function link() |
|
60 | { |
||
61 | 3 | return $this->link; |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * Returns both title and body content. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | 9 | public function post() |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * Returns the title text. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 3 | public function title() |
|
82 | } |
||
83 | } |
||
84 |