ResultListMovies::getDateAddedColumn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
/**
4
 * ResultList implementation for movies
5
 *
6
 * @author Sam Stenvall <[email protected]>
7
 * @copyright Copyright &copy; Sam Stenvall 2014-
8
 * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
9
 */
10
class ResultListMovies extends ResultList
11
{
12
13
	public function getColumnDefinitions()
14
	{
15
		return array(
16
			$this->getLabelColumn(),
17
			$this->getYearColumn(),
18
			$this->getGenreColumn(),
19
			$this->getRatingColumn(),
20
			$this->getRuntimeColumn(),
21
			$this->getDateAddedColumn(),
22
		);
23
	}
24
25
	/**
26
	 * Returns the column definition for the rating column
27
	 * @return array
28
	 */
29
	private function getRatingColumn()
30
	{
31
		return array(
32
			'name'=>'rating',
33
			'header'=>Yii::t('MovieList', 'Rating'),
34
			'value'=>function($data) {
35
				/* @var $data Movie */
36
				echo $data->getRating();
37
			}
38
		);
39
	}
40
41
	/**
42
	 * Returns the column definition for the runtime column
43
	 * @return array
44
	 */
45
	private function getRuntimeColumn()
46
	{
47
		return array(
48
			'name'=>'runtime',
49
			'header'=>Yii::t('GenericList', 'Runtime'),
50
			'value'=>function($data) {
51
				/* @var $data Movie */
52
				echo $data->getRuntimeString();
53
			}
54
		);
55
	}
56
57
58
	/**
59
	 * Returns the column definition for the dateadded column
60
	 * @return array
61
	 */
62
	private function getDateAddedColumn()
63
	{
64
		return [
65
			'name'   => 'dateadded',
66
			'header' => Yii::t('MovieList', 'Date added'),
67
			'value'  => function ($data) {
68
				/** @var Movie $data */
69
				echo $data->getDateAdded();
70
			},
71
		];
72
	}
73
}
74