Completed
Push — develop ( be0029...6f5013 )
by Daniel
21:40 queued 10s
created

item   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 43
rs 10
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __isset() 0 3 2
A __get() 0 4 2
A get_link() 0 9 2
1
<?php
2
3
/**
4
 *
5
 * @package sitemaker
6
 * @copyright (c) 2019 Daniel A. (blitze)
7
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
8
 *
9
 */
10
11
namespace blitze\sitemaker\services\simplepie;
12
13
class item extends \SimplePie_Item
14
{
15
	/**
16
	 * Magic method handler
17
	 *
18
	 * @param string $name Property name
19
	 * @return mixed
20
	 */
21
	public function __get($name)
22
	{
23
		$method = 'get_' . $name;
24
		return (isset($this, $method)) ? $this->{$method}() : '';
25
	}
26
27
	/**
28
	 * Magic method handler
29
	 *
30
	 * @param string $name Property name
31
	 * @return bool
32
	 */
33
	public function __isset($name)
34
	{
35
		return method_exists($this, 'get_' . $name) ? true : false;
36
	}
37
38
	/**
39
	 * Override this method to fix issue in php 7.4
40
	 * Get a single link for the item
41
	 *
42
	 * @since Beta 3
43
	 * @param int $key The link that you want to return.  Remember that arrays begin with 0, not 1
44
	 * @param string $rel The relationship of the link to return
45
	 * @return string|null Link URL
46
	 */
47
	public function get_link($key = 0, $rel = 'alternate')
48
	{
49
		$links = $this->get_links($rel);
50
		if (isset($links[$key]))
51
		{
52
			return $links[$key];
53
		}
54
55
		return null;
56
	}
57
}
58