Page   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B init() 0 21 5
1
<?php
2
3
/**
4
 * @package Cadmium\System\Modules\Entitizer
5
 * @author Anton Romanov
6
 * @copyright Copyright (c) 2015-2017, Anton Romanov
7
 * @link http://cadmium-cms.com
8
 */
9
10
namespace Modules\Entitizer\Dataset {
11
12
	use Modules\Entitizer, Modules\Settings;
13
14
	class Page extends Entitizer\Utils\Dataset {
15
16
		use Entitizer\Common\Page;
17
18
		/**
19
		 * Initialize the dataset
20
		 */
21
22
		protected function init() {
23
24
			$this->addVirtual('active', function (array $data) {
25
26
				return (($data['visibility'] === VISIBILITY_PUBLISHED) && !$data['locked']);
27
			});
28
29
			$this->addVirtual('link', function (array $data) {
30
31
				if ('' === $data['slug']) return '';
32
33
				return (INSTALL_PATH . '/' . $data['slug']);
34
			});
35
36
			$this->addVirtual('canonical', function (array $data) {
37
38
				if ('' === $data['slug']) return '';
39
40
				return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : ''));
41
			});
42
		}
43
	}
44
}
45