PhpLoader::loadResource()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
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