WatchedIconTrait::getWatchedIcon()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 2
eloc 3
c 1
b 1
f 0
nc 2
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
/**
4
 * Trait for API items that contain a "playcount" property. If provides a 
5
 * method for rendering an icon which represents that the item is marked as 
6
 * watched in the library. 
7
 * 
8
 * @author Sam Stenvall <[email protected]>
9
 * @copyright Copyright &copy; Sam Stenvall 2013-
10
 * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
11
 */
12
trait WatchedIconTrait
13
{
14
15
	/**
16
	 * @var int
17
	 */
18
	public $playcount;
19
20
	/**
21
	 * @return string the HTML for a watched icon. An empty string is returned 
22
	 * if the item has not been watched
23
	 */
24
	public function getWatchedIcon()
25
	{
26
		if ($this->playcount > 0)
27
			return CHtml::tag('i', array('class'=>'watched-icon fa fa-check'), '');
28
29
		return '';
30
	}
31
32
}
33