AbstractSearchResult::setRelevance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
namespace Apps\Model\Front\Search;
4
5
use Ffcms\Core\Helper\Date;
6
7
/**
8
 * Class AbstractSearchResult. Static setter & getter instance to organize search result items.
9
 * Yes, i know it's a fully sh@t for php, but this is most useful when extending model should follow union format.
10
 * Maybe interface and __magic is better, you can suggest it on github ;)
11
 * @package Apps\Model\Front\Search
12
 */
13
class AbstractSearchResult
14
{
15
    protected $title;
16
    protected $snippet;
17
    protected $uri;
18
    protected $date;
19
    protected $relevance;
20
21
    /**
22
     * Set item title
23
     * @param string $value
24
     */
25
    public function setTitle($value)
26
    {
27
        $this->title = $value;
28
    }
29
30
    /**
31
     * Get item title
32
     * @return string|null
33
     */
34
    public function getTitle()
35
    {
36
        return $this->title;
37
    }
38
39
    /**
40
     * Set item snippet
41
     * @param string $value
42
     */
43
    public function setSnippet($value)
44
    {
45
        $this->snippet = $value;
46
    }
47
48
    /**
49
     * Get item snippet
50
     * @return string|null
51
     */
52
    public function getSnippet()
53
    {
54
        return $this->snippet;
55
    }
56
57
    /**
58
     * Set item uri path
59
     * @param string $value
60
     */
61
    public function setUri($value)
62
    {
63
        $this->uri = $value;
64
    }
65
66
    /**
67
     * Get item path
68
     * @return string
69
     */
70
    public function getUri()
71
    {
72
        return $this->uri;
73
    }
74
75
    /**
76
     * Set item date
77
     * @param string $value
78
     */
79
    public function setDate($value)
80
    {
81
        $this->date = Date::humanize($value);
82
    }
83
84
    /**
85
     * Get item date
86
     * @return string
87
     */
88
    public function getDate()
89
    {
90
        return $this->date;
91
    }
92
93
    /**
94
     * Set item relevance
95
     * @param int|float $value
96
     */
97
    public function setRelevance($value)
98
    {
99
        $this->relevance = $value;
100
    }
101
102
    /**
103
     * Get item relevance
104
     * @return float|int
105
     */
106
    public function getRelevance()
107
    {
108
        return $this->relevance;
109
    }
110
}
111