ApplicationInfoPlugin::getResources()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Apie\ApplicationInfoPlugin;
5
6
use Apie\ApplicationInfoPlugin\ApiResources\ApplicationInfo;
7
use Apie\ApplicationInfoPlugin\ResourceFactories\ApplicationInfoRetrieverFallbackFactory;
8
use Apie\Core\Interfaces\ApiResourceFactoryInterface;
9
use Apie\Core\PluginInterfaces\ApieAwareInterface;
10
use Apie\Core\PluginInterfaces\ApieAwareTrait;
11
use Apie\Core\PluginInterfaces\ApiResourceFactoryProviderInterface;
12
use Apie\Core\PluginInterfaces\ResourceProviderInterface;
13
14
class ApplicationInfoPlugin implements ResourceProviderInterface, ApiResourceFactoryProviderInterface, ApieAwareInterface
15
{
16
    use ApieAwareTrait;
17
18
    /**
19
     * @var string|null
20
     */
21
    private $appName;
22
23
    /**
24
     * @var string|null
25
     */
26
    private $environment;
27
28
    /**
29
     * @var string|null
30
     */
31
    private $hash;
32
33
    public function __construct(
34
        ?string $appName = null,
35
        ?string $environment = null,
36
        ?string $hash = null
37
    ) {
38
        $this->appName = $appName;
39
        $this->environment = $environment;
40
        $this->hash = $hash;
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function getResources(): array
47
    {
48
        return [ApplicationInfo::class];
49
    }
50
51
    /**
52
     * {@inheritDoc}
53
     */
54
    public function getApiResourceFactory(): ApiResourceFactoryInterface
55
    {
56
        return new ApplicationInfoRetrieverFallbackFactory($this->appName, $this->environment, $this->hash, $this->getApie()->isDebug());
57
    }
58
}
59