FSAbstract::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Class FSAbstract
4
 *
5
 * @filesource   FSAbstract.php
6
 * @created      06.03.2017
7
 * @package      chillerlan\Filereader
8
 * @author       Smiley <[email protected]>
9
 * @copyright    2017 Smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\Filereader;
14
15
use chillerlan\Filereader\Drivers\FSDriverInterface;
16
17
/**
18
 * @property string $path
19
 */
20
abstract class FSAbstract implements FSInterface{
21
22
	/**
23
	 * @var \chillerlan\Filereader\Drivers\FSDriverInterface
24
	 */
25
	protected $filereader;
26
27
	/**
28
	 * @var string
29
	 */
30
	protected $path;
31
32
	/**
33
	 * FSAbstract constructor.
34
	 *
35
	 * @param \chillerlan\Filereader\Drivers\FSDriverInterface $driver
36
	 */
37
	public function __construct(FSDriverInterface $driver){
38
		$this->filereader = $driver;
39
	}
40
41
	/**
42
	 * @param string $name
43
	 *
44
	 * @return mixed
45
	 */
46
	public function __get(string $name){
47
48
		if(property_exists($this, $name) && $name !== 'filereader'){
49
			return $this->{$name};
50
		}
51
52
		return null;
53
	}
54
55
	/**
56
	 * @return array
57
	 */
58
	public function info():array{
59
		return pathinfo($this->path);
60
	}
61
62
}
63