GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

RssReader::setItems()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package domain
4
 * @subpackage models
5
 * @author marius orcsik <[email protected]>
6
 * @date 2010.04.13
7
 */
8
namespace vsc\domain\models;
9
10
use vsc\domain\domain\RssItem;
11
use vsc\infrastructure\Base;
12
use vsc\ExceptionUnimplemented;
13
14
class RssReader extends XmlReader {
15
	public $title;
16
	public $link;
17
	public $description;
18
	public $generator;
19
	public $docs;
20
	public $language;
21
	public $pubDate;
22
	public $lastBuildDate;
23
	private $items = array();
24
25 1
	public function getItems() {
26 1
		return $this->items;
27
	}
28
29 1
	public function setItems($aItems) {
30 1
		$this->items = $aItems;
31 1
	}
32
33 1
	public function addItem(RssItem $oElement) {
34 1
		$this->items[] = $oElement;
35 1
	}
36
37
	/**
38
	 * @param integer $iIndex
39
	 * @return Base
40
	 */
41 1
	public function getItem($iIndex) {
42 1
		if (isset ($this->items[$iIndex])) {
43
			return $this->items[$iIndex];
44
		} else {
45 1
			return new Base();
46
		}
47
	}
48
49 1
	public function buildObj() {
50 1
		parent::buildObj();
51
52 1
		$oNode = $this->getDom()->getElementsByTagName('channel')->item(0);
53 1
		if ($oNode instanceof \DOMElement) {
54
			$this->parseToEntity($oNode->childNodes);
55
		}
56 1
	}
57
58
	/**
59
	 * @param \DOMNodeList $aChildNodes
60
	 */
61 1
	public function parseToEntity($aChildNodes) {
62 1
		if ($aChildNodes instanceof \DOMNodeList) {
63 1
			foreach ($aChildNodes as $oChildNode) {
64
				$sNodeName = $oChildNode->nodeName;
65
				if ($oChildNode->nodeType == XML_ELEMENT_NODE) {
66
					if ($sNodeName == 'item') {
67
						$oRssItem = new RssItem($oChildNode);
68
						$this->addItem($oRssItem);
69
					} elseif ($this->valid($sNodeName)) {
0 ignored issues
show
Unused Code introduced by
The call to RssReader::valid() has too many arguments starting with $sNodeName.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
70
						try {
71
							$this->$sNodeName = $oChildNode->nodeValue;
72
						} catch (ExceptionUnimplemented $e) {
0 ignored issues
show
Unused Code introduced by
catch (\vsc\ExceptionUnimplemented $e) { } does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
73
							// the property didn't exist
74
						}
75
					}
76
				}
77
			}
78
		}
79 1
	}
80
}
81