Passed
Pull Request — master (#10)
by Anton
04:10
created

Popup   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A block() 0 17 2
1
<?php
2
3
namespace Utils {
4
5
	use Template;
6
7
	abstract class Popup extends Messages {
8
9
		protected static $types = ['positive', 'negative'];
10
11
		protected static $items = [];
12
13
		# Get block
14
15
		public static function block() {
16
17
			$popup = Template::group(); $icons = ['positive' => 'checkmark', 'negative' => 'warning'];
18
19
			foreach (static::$items as $type => $item) {
20
21
				$popup->add($block = View::get('Blocks\Utils\Popup'));
22
23
				$block->type = $type; $block->text = Template::block($item['text']);
24
25
				$block->title = ($item['title'] ?? null); $block->icon = $icons[$type];
26
			}
27
28
			# ------------------------
29
30
			return $popup;
31
		}
32
	}
33
}
34