Stations::setStationsParser()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * User: ms
4
 * Date: 29.08.15
5
 * Time: 14:34
6
 */
7
8
namespace Mvg\TextOutput;
9
10
use  Mvg\Parser\Html\Stations as StationsParser;
0 ignored issues
show
Coding Style introduced by
There must be a single space after the USE keyword
Loading history...
11
12
class Stations {
13
14
	/**
15
	 * @var \ Mvg\Parser\Html\Stations
16
	 */
17
	protected $stationsParser = null;
18
19
	/**
20
	 * @param  \ Mvg\Parser\Html\Stations $stationsParser
21
	 */
22
	public function __construct(StationsParser $stationsParser) {
23
		$this->setStationsParser($stationsParser);
24
	}
25
26
	public function getOutput() {
27
		$str = '';
28
		foreach ($this->getStationsParser()->getStationsForTerm() as $station) {
29
			$str .= $station->name . "\n";
30
		}
31
		return $str;
32
	}
33
34
	/**
35
	 * @return \ Mvg\Parser\Html\Stations
36
	 */
37
	protected function getStationsParser() {
38
		return $this->stationsParser;
39
	}
40
41
	/**
42
	 * @param \ Mvg\Parser\Html\Stations $stationsParser
43
	 */
44
	protected function setStationsParser(StationsParser $stationsParser) {
45
		$this->stationsParser = $stationsParser;
0 ignored issues
show
Documentation Bug introduced by
It seems like $stationsParser of type object<Mvg\Parser\Html\Stations> is incompatible with the declared type object<> of property $stationsParser.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
46
	}
47
48
49
}