Liker   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A liked() 0 3 1
A disliked() 0 3 1
A getSign() 0 3 1
1
<?php
2
3
namespace Osnova\Services\Timeline;
4
5
class Liker extends Author
6
{
7
    /**
8
     * Get like sign.
9
     * "1" means that user liked entity, "-1" - disliked.
10
     *
11
     * @return int
12
     */
13
    public function getSign()
14
    {
15
        return intval($this->getData('sign'));
16
    }
17
18
    /**
19
     * Determines whether the user liked entity.
20
     *
21
     * @return bool
22
     */
23
    public function liked()
24
    {
25
        return $this->getSign() === 1;
26
    }
27
28
    /**
29
     * Determines whether the user disliked entity.
30
     *
31
     * @return bool
32
     */
33
    public function disliked()
34
    {
35
        return $this->getSign() === -1;
36
    }
37
}
38