Passed
Push — revert-interface-change ( ccb51e...f9a91e )
by Jakob
06:03 queued 01:30
created

HashArrayElement   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 31
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getHash() 0 3 1
A getInstances() 0 17 2
1
<?php
2
3
namespace Wikibase\DataModel\Fixtures;
4
5
use Hashable;
6
7
/**
8
 * @license GPL-2.0+
9
 * @author Jeroen De Dauw < [email protected] >
10
 */
11
class HashArrayElement implements Hashable {
12
13
	public $text = '';
14
15
	public function __construct( $text ) {
16
		$this->text = $text;
17
	}
18
19
	public function getHash() {
20
		return sha1( $this->text );
21
	}
22
23
	public static function getInstances() {
24
		$stuff = [
25
			'foo',
26
			'bar',
27
			'baz',
28
			'bah',
29
			'~=[,,_,,]:3',
30
		];
31
32
		$instances = [];
33
34
		foreach ( $stuff as $thinghy ) {
35
			$instances[] = new static( $thinghy );
36
		}
37
38
		return $instances;
39
	}
40
41
}
42