GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbacLoader::getExtensionAllowed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Projet :  php-abac.
4
 * User: mvedie
5
 * Date: 24/11/2016
6
 * Time: 18:51
7
 */
8
9
namespace PhpAbac\Loader;
10
11
use PhpAbac\Manager\ConfigurationManager;
12
use Symfony\Component\Config\FileLocatorInterface;
13
use Symfony\Component\Config\Loader\FileLoader;
14
15
abstract class AbacLoader extends FileLoader {
16
	/**
17
	 * Must be overrided to contains an array of allowed extension
18
	 */
19
	protected static $_EXTENSION_ALLOWED_A = [];
20
	
21
	/** @var  ConfigurationManager The configuration manage instanciator and user of this AbacLoader Instance */
22
	protected $configurationManger;
23
	
24 18
	public function __construct( FileLocatorInterface $locator ) {
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces between opening bracket and type hint "FileLocatorInterface"; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces between argument "$locator" and closing bracket; 1 found
Loading history...
25 18
		parent::__construct( $locator );
26 18
	}
27
	
28
	/**
29
	 * Method to load a resource and return an array that contains decoded data of the resource
30
	 *
31
	 * @param string $resource The path of the resource to load
32
	 * @param null   $type     ??
33
	 *
34
	 * @return string
35
	 */
36
	abstract public function load( $resource, $type = null );
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces between opening bracket and argument "$resource"; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces between argument "$type" and closing bracket; 1 found
Loading history...
37
	
38
//	/**
39
//	 * Method to check if a resource ( by his path ) is supported by the loader
40
//	 *
41
//	 * @param string $resource The path of the resource to check
42
//	 * @param null   $type     ??
43
//	 *
44
//	 * @return boolean Return true if the resource is supported by the loader
45
//	 */
46
//	abstract public function supports( $resource, $type = null );
47
	
48
	/**
49
	 * Method to check if a resource is supported by the loader
50
	 * This method check only extension file
51
	 *
52
	 * @param $resource
53
	 *
54
	 * @return boolean Return true if the extension of the ressource is supported by the loader
55
	 */
56 18
	public static final function supportsExtension( $resource ) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, final should precede the visibility keyword.
Loading history...
Coding Style introduced by
Expected 0 spaces between opening bracket and argument "$resource"; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces between argument "$resource" and closing bracket; 1 found
Loading history...
57 18
		return in_array( pathinfo( $resource, PATHINFO_EXTENSION ), self::getExtensionAllowed() );
58
	}
59
60
    /**
61
	 * Method to return allowed extension for file to load with the loader
62
     * @return mixed
63
     */
64 18
	private static final function getExtensionAllowed() {
0 ignored issues
show
Coding Style introduced by
As per PSR2, final should precede the visibility keyword.
Loading history...
65 18
		return static::$_EXTENSION_ALLOWED_A;
66
	}
67
}
68
69
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
70