Passed
Pull Request — master (#21)
by Tim
04:02
created

CampaignConfigurationLoader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\BannerServer\UseCase\BannerSelection;
6
7
use FileFetcher\FileFetcher;
8
use Symfony\Component\Filesystem\Filesystem;
9
use Symfony\Component\Yaml\Yaml;
10
11
/**
12
 * @license GNU GPL v2+
13
 */
14
class CampaignConfigurationLoader {
15
16
	private const SEASONAL_IMPRESSION_LIMIT = 10;
17
18
	private $fileSystem;
19
	private $fileFetcher;
20
21
	public function __construct( Filesystem $fileSystem, FileFetcher $fileFetcher ) {
22
		$this->fileSystem = $fileSystem;
23
		$this->fileFetcher = $fileFetcher;
24
	}
25
26
	private function loadFiles( string ...$configFiles ): array {
0 ignored issues
show
Unused Code introduced by
The method loadFiles() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
27
		$configs = [];
28
		foreach ( $configFiles as $file ) {
29
			if ( $this->fileSystem->exists( $file ) ) {
30
				$configs[] = Yaml::parse( $this->fileFetcher->fetchFile( $file ) );
31
			}
32
		}
33
		return $configs;
34
	}
35
}