Completed
Push — master ( 7fc3e1...d9b76d )
by Sam
12s queued 10s
created

Movie::getDateAdded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Represents a movie
5
 *
6
 * @author Sam Stenvall <[email protected]>
7
 * @copyright Copyright &copy; Sam Stenvall 2013-
8
 * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
9
 * 
10
 * Virtual class properties:
11
 * 
12
 * @property int $votes
13
 */
14
class Movie extends File implements IStreamable
15
{
16
17
	/**
18
	 * @var int
19
	 */
20
	public $movieid;
21
22
	/**
23
	 * @var string
24
	 */
25
	public $tagline;
26
	
27
	/**
28
	 * @var array the directors for this movie
29
	 */
30
	public $director;
31
32
	/**
33
	 * @var string the date the movie was added to the library 
34
	 */
35
	public $dateadded;
36
37
	/**
38
	 * @var int
39
	 */
40
	private $_votes;
41
42
	public function getDisplayName()
43
	{
44
		return $this->label.' ('.$this->year.')';
45
	}
46
	
47
	/**
48
	 * @return int the vote count
49
	 */
50
	public function getVotes()
51
	{
52
		return $this->_votes;
53
	}
54
55
	/**
56
	 * Setter for votes. The value returned from the API is a string which 
57
	 * we'll convert to an integer.
58
	 * @param string $votes
59
	 */
60
	public function setVotes($votes)
61
	{
62
		$this->_votes = (int)str_replace(',', '', $votes);
63
	}
64
	
65
	/**
66
	 * @return string the first credited director, or an empty string
67
	 */
68
	public function getDirector()
69
	{
70
		if ($this->director === null || count($this->director) === 0)
71
			return '';
72
		else
73
			return $this->director[0];
74
	}
75
76
	/**
77
	 * @return string the URL to the movie's IMDb page
78
	 */
79
	public function getIMDbUrl()
80
	{
81
		return 'http://www.imdb.com/title/'.$this->imdbnumber.'/';
82
	}
83
84
	/**
85
	 * @return string
86
	 */
87
	public function getDateAdded()
88
	{
89
		return $this->dateadded;
90
	}
91
}
92