News::getDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace AL\Common\Model\News;
3
4
require_once __DIR__."/../../../config/config.php";
5
require_once __DIR__."/../../../lib/functions.php";
6
7
/**
8
 * Maps to the `news` and `news_image` tables
9
 */
10
class News {
11
    private $id;
12
    private $headline;
13
    private $text;
14
    private $date;
15
    private $image;
16
    private $image_id;
17
    private $userid;
0 ignored issues
show
introduced by
The private property $userid is not used, and could be removed.
Loading history...
18
19
    public function __construct(
20
        $id,
21
        $headline,
22
        $text,
23
        $date,
24
        $image,
25
        $image_id,
26
        $user
27
    ) {
28
        $this->id = $id;
29
        $this->headline = $headline;
30
        $this->text = $text;
31
        $this->date = $date;
32
        $this->user = $user;
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
33
        $this->image_id = $image_id;
34
35
        if ($image != null) {
36
            $this->image = $GLOBALS['news_images_path'].$image;
37
        }
38
    }
39
40
    public function getId() {
41
        return $this->id;
42
    }
43
44
    public function getHeadline() {
45
        return $this->headline;
46
    }
47
48
    public function getText() {
49
        return $this->text;
50
    }
51
52
    public function getDate() {
53
        return $this->date;
54
    }
55
56
    public function getImage() {
57
        return $this->image;
58
    }
59
60
    public function getImageId() {
61
        return $this->image_id;
62
    }
63
64
    public function getUser() {
65
        return $this->user;
66
    }
67
68
    /**
69
     * @return The HTML-ized version of the text (with the AL code
0 ignored issues
show
Bug introduced by
The type AL\Common\Model\News\The was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
70
     *  rendered to HTML and smilies removed)
71
     */
72
    public function getHtmlText() {
73
        return nl2br(InsertALCode(RemoveSmillies($this->text)));
0 ignored issues
show
Bug Best Practice introduced by
The expression return nl2br(InsertALCod...Smillies($this->text))) returns the type string which is incompatible with the documented return type AL\Common\Model\News\The.
Loading history...
74
    }
75
}
76