IdGeneratorFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIdGenerator() 0 10 2
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace IdGenerator;
6
7
use IdGenerator\PackagePrivate\DatabaseIdGenerator;
8
use IdGenerator\PackagePrivate\PagePropsIdDatabase;
9
use Wikimedia\Rdbms\ILoadBalancer;
10
11
class IdGeneratorFactory {
12
13
	private $generator;
14
15 1
	public function getIdGenerator( ILoadBalancer $loadBalancer ): IdGenerator {
16 1
		if ( $this->generator === null ) {
17 1
			$this->generator = new DatabaseIdGenerator(
18 1
				$loadBalancer,
19 1
				new PagePropsIdDatabase()
20
			);
21
		}
22
23 1
		return $this->generator;
24
	}
25
26
}
27