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

Popup::block()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 17
rs 9.4285
cc 2
eloc 7
nc 2
nop 0
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