GameReview::getGameName()   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\Review;
3
4
require_once __DIR__."/../../../lib/functions.php";
5
6
/**
7
 * Maps to the `review_game` and `review_main` tables
8
 */
9
class GameReview {
10
    private $id;
11
    private $text;
12
    private $date;
13
    private $user;
14
    private $game_name;
15
16
    public function __construct($id, $text, $date, $user, $game_name) {
17
        $this->id = $id;
18
        $this->text = $text;
19
        $this->date = $date;
20
        $this->user = $user;
21
        $this->game_name = $game_name;
22
    }
23
24
    public function getId() {
25
        return $this->id;
26
    }
27
28
    public function getText() {
29
        return $this->text;
30
    }
31
32
    public function getDate() {
33
        return $this->date;
34
    }
35
36
    public function getUser() {
37
        return $this->user;
38
    }
39
40
    public function getGameName() {
41
        return $this->game_name;
42
    }
43
44
    /**
45
     * @return string The HTML text for the frontpage
46
     */
47
    public function getFrontPageHtml() {
48
        $pos_start = strpos($this->text, '[frontpage]');
49
        $pos_end = strpos($this->text, '[/frontpage]');
50
        $nr_char = $pos_end - $pos_start;
51
        $frontpage = substr($this->text, $pos_start, $nr_char);
52
        return InsertALCode(RemoveSmillies($frontpage));
53
    }
54
}
55