PropertyRegistry   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 48
rs 10
c 0
b 0
f 0
ccs 26
cts 26
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 37 3
1
<?php
2
3
namespace SBL;
4
5
use SMW\DIProperty;
6
7
/**
8
 * @license GNU GPL v2+
9
 * @since 1.0
10
 *
11
 * @author mwjames
12
 */
13
class PropertyRegistry {
14
15
	const SBL_PARENTPAGE = '__sbl_parentpage';
16
17
	/**
18
	 * @since 1.0
19
	 *
20
	 * @return boolean
21
	 */
22 1
	public function register( $propertyRegistry ) {
23
24
		$propertyDefinitions = [
25
26 1
			self::SBL_PARENTPAGE => [
27 1
				'label' => SBL_PROP_PARENTPAGE,
28 1
				'type'  => '_wpg',
29 1
				'alias' => 'sbl-property-alias-parentpage',
30
				'visbility' => true
31 1
			]
32 1
		];
33
34 1
		foreach ( $propertyDefinitions as $propertyId => $definition ) {
35
36 1
			$propertyRegistry->registerProperty(
37 1
				$propertyId,
38 1
				$definition['type'],
39 1
				$definition['label'],
40 1
				$definition['visbility']
41 1
			);
42
43 1
			$propertyRegistry->registerPropertyAlias(
44 1
				$propertyId,
45 1
				wfMessage( $definition['alias'] )->text()
46 1
			);
47
48
			// 2.4+
49 1
			if ( method_exists( $propertyRegistry, 'registerPropertyAliasByMsgKey' ) ) {
50 1
				$propertyRegistry->registerPropertyAliasByMsgKey(
51 1
					$propertyId,
52 1
					$definition['alias']
53 1
				);
54 1
			}
55 1
		}
56
57 1
		return true;
58
	}
59
60
}
61