Completed
Pull Request — master (#2)
by Pol
06:02
created

Provider::withResource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace drupol\Yaroc\Plugin\Method;
6
7
use drupol\Yaroc\Plugin\AbstractProvider;
8
use drupol\Yaroc\Plugin\ProviderInterface;
9
10
/**
11
 * Class Provider.
12
 */
13
class Provider extends AbstractProvider
14
{
15
    /**
16
     * @var string
17
     */
18
    private $resource;
19
20
    /**
21
     * @param string $resource
22
     *
23
     * @return \drupol\Yaroc\Plugin\ProviderInterface
24
     */
25
    public static function withResource(string $resource) :ProviderInterface
26
    {
27
        $clone = new static();
28
        $clone->resource = $resource;
29
30
        return $clone;
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getResource(): string
37
    {
38
        return $this->resource;
39
    }
40
}
41