ResultFormat   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 30
ccs 12
cts 14
cp 0.8571
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getNameMessageKey() 0 2 1
A getParameterDefinitions() 0 2 1
A buildPresenter() 0 2 1
A getName() 0 2 1
A __construct() 0 7 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace ModernTimeline\ResultFacade;
6
7
class ResultFormat {
8
9
	/**
10
	 * @var callable
11
	 */
12
	private $constructionFunction;
13
14 5
	public function __construct(
15 5
		private string $name,
16 5
		private string $nameMessageKey,
17 5
		private array $parameterDefinitions,
18 5
		callable $presenterBuilder
19 5
	) {
20
		$this->constructionFunction = $presenterBuilder;
21 5
	}
22 5
23
	public function getName(): string {
24
		return $this->name;
25
	}
26
27
	public function getNameMessageKey(): string {
28
		return $this->nameMessageKey;
29 5
	}
30 5
31
	public function getParameterDefinitions(): array {
32
		return $this->parameterDefinitions;
33 4
	}
34 4
35
	public function buildPresenter(): ResultPresenter {
36
		return call_user_func( $this->constructionFunction );
37
	}
38
39
}
40