Completed
Pull Request — master (#37)
by Chris
02:41
created

Php   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 13 5
1
<?php
2
namespace Darya\Foundation\Configuration;
3
4
use Darya\Foundation\AbstractConfiguration;
5
6
/**
7
 * Darya's PHP file configuration implementation.
8
 * 
9
 * @author Chris Andrew <[email protected]>
10
 */
11
class Php extends AbstractConfiguration
12
{
13
	/**
14
	 * Build a new configuration from the PHP files at the given paths.
15
	 * 
16
	 * @param array|string $paths
17
	 */
18
	public function __construct($paths)
19
	{
20
		$data = array();
21
		$paths = (array) $paths;
22
		
23
		foreach ($paths as $path) {
24
			if (is_file($path) && preg_match('/\.php$/', $path)) {
25
				$data = array_merge($data, include $path ?: array());
26
			}
27
		}
28
		
29
		$this->data = $data;
30
	}
31
}
32