Completed
Push — master ( 2c84d0...dc4ad7 )
by Steve
04:23
created

AbstractComponent::getConfigPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @package    Fuel\Foundation
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2016 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fuel\Foundation;
14
15
use ReflectionClass;
16
17
abstract class AbstractComponent implements ComponentInterface
18
{
19
	/**
20
	 * Gets the directory where the component's configs can be found.
21
	 * This uses reflection so if you have a large number of components it would be advisable to extend this and use
22
	 * `__DIR__` to generate a return value.
23
	 *
24
	 * @return string
25
	 */
26
	public function getConfigPath() : string
27
	{
28
		$reflection = new ReflectionClass(static::class);
29
		return dirname($reflection->getFileName());
30
	}
31
}
32