Passed
Push — 0.3.0 ( 0d73f1...9a02d7 )
by Anton
04:10
created

Page   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B init() 0 21 5
1
<?php
2
3
namespace Modules\Entitizer\Dataset {
4
5
	use Modules\Entitizer, Modules\Settings;
6
7
	class Page extends Entitizer\Utils\Dataset {
8
9
		use Entitizer\Common\Page;
10
11
		# Init dataset
12
13
		protected function init() {
14
15
			$this->addHandler('active', function (array $data) {
16
17
				return (($data['visibility'] === VISIBILITY_PUBLISHED) && !$data['locked']);
18
			});
19
20
			$this->addHandler('link', function (array $data) {
21
22
				if ('' === $data['slug']) return '';
23
24
				return (INSTALL_PATH . '/' . $data['slug']);
25
			});
26
27
			$this->addHandler('canonical', function (array $data) {
28
29
				if ('' === $data['slug']) return '';
30
31
				return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : ''));
32
			});
33
		}
34
	}
35
}
36