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

Log   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setFilename() 0 4 1
A getFilename() 0 4 1
A getContent() 0 8 2
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