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

CampaignConfigurationLoader   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 20
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A loadFiles() 0 8 3
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
}