Passed
Push — master ( fd93c6...4910da )
by Tomáš
04:38
created

PriceCalculatorFactory::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Sunfox\PriceCalculator;
4
5
final class PriceCalculatorFactory
6
{
7
	/**
8
	 * @var string
9
	 */
10
	private $class;
11
12
	/**
13
	 * Accepts class name with full namespace.
14
	 */
15 1
	public function __construct(string $class = PriceCalculator::class)
16
	{
17 1
		$this->class = $class;
18 1
	}
19
20
	/**
21
	 * Create and return PriceCalculator instance.
22
	 */
23
	public function create(): IPriceCalculator
24
	{
25 1
		return new $this->class;
26
	}
27
28
	/**
29
	 * Get class name.
30
	 */
31
	public function getClass(): string
32
	{
33 1
		return $this->class;
34
	}
35
36
	/**
37
	 * Set class name.
38
	 */
39 1
	public function setClass(string $class): self
40
	{
41 1
		$this->class = $class;
42 1
		return $this;
43
	}
44
}
45