PhpLoader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loadResource() 0 5 1
A supports() 0 4 2
1
<?php
2
3
namespace GalantomApi\Description;
4
5
/**
6
 * Class PhpLoader
7
 * @package GalantomApi\Description
8
 */
9
class PhpLoader extends FileLoader
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 2
    public function loadResource($resource)
15
    {
16
        /** @noinspection PhpIncludeInspection */
17 2
        return require $resource;
18
    }
19
20
    /**
21
     * Returns whether this class supports the given resource.
22
     *
23
     * @param mixed $resource A resource
24
     * @param string|null $type The resource type or null if unknown
25
     *
26
     * @return bool True if this class supports the given resource, false otherwise
27
     */
28 2
    public function supports($resource, $type = null)
29
    {
30 2
        return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION);
31
    }
32
}
33