Completed
Push — master ( 589fec...539028 )
by Milan
07:58
created

Log::getFilename()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace h4kuna\Fio\Request;
4
5
use h4kuna\Fio\Exceptions\InvalidState;
6
7
class Log
8
{
9
10
	private $filename = '';
11
12
13
	public function setFilename(string $filename): void
14
	{
15
		$this->filename = $filename;
16
	}
17
18
19
	public function getFilename(): string
20
	{
21
		return $this->filename;
22
	}
23
24
25
	public function getContent(): string
26
	{
27
		$content = @file_get_contents($this->filename);
28
		if ($content === false) {
29
			throw new InvalidState(sprintf('Filname "%s" can not read.', $this->filename));
30
		}
31
		return $content;
32
	}
33
34
}
35