Passed
Push — develop ( 319bd8...330c7a )
by Neill
16:41 queued 15s
created

DateRange   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 47
ccs 0
cts 23
cp 0
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 6 2
A registerScripts() 0 3 1
A getProperties() 0 3 1
A getFormat() 0 3 1
A getComponentDetails() 0 4 1
1
<?php
2
/**
3
 * @link http://www.newicon.net/neon
4
 * @copyright Copyright (c) 21/09/2016 Newicon Ltd
5
 * @license http://www.newicon.net/neon/license/
6
 */
7
8
namespace neon\core\form\fields\el;
9
10
use neon\core\grid\query\IQuery;
11
use neon\core\form\fields\Field;
12
use neon\core\form\fields\el\assets\ElAsset;
13
use neon\core\helpers\Html;
14
use neon\core\helpers\Arr;
15
16
class DateRange extends DateTimeRange
17
{
18
	public $type = 'daterange';
19
20
	/**
21
	 * @inheritdoc
22
	 */
23
	public function getProperties()
24
	{
25
		return array_merge(parent::getProperties(), ['type', 'format']);
26
	}
27
28
	/**
29
	 * @inheritdoc
30
	 */
31
	public function getValue()
32
	{
33
		$value = parent::getValue();
34
		if (is_array($value))
0 ignored issues
show
introduced by
The condition is_array($value) is always true.
Loading history...
35
			return $value;
36
		return ['from' => '', 'to' => ''];
37
	}
38
39
	/**
40
	 * Get the picker format
41
	 * @return string
42
	 */
43
	public function getFormat()
44
	{
45
		return neon()->formatter->dateFormat;
46
	}
47
48
	/**
49
	 * @inheritdoc
50
	 */
51
	public function registerScripts($view)
52
	{
53
		ElAsset::register($view);
54
	}
55
56
	/**
57
	 * @inheritdoc
58
	 */
59
	public function getComponentDetails()
60
	{
61
		return [
62
			'label' => 'DateRange', 'group' => 'Form Only', 'icon' => 'fa fa-calendar-o', 'order' => 910,
63
		];
64
	}
65
}