Passed
Push — develop ( 77e6e2...97cb86 )
by Daniel
03:55
created

url   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A display_field() 0 3 1
A get_validation_rules() 0 7 1
A get_name() 0 3 1
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\services\form\field;
11
12
class url extends base
13
{
14
	/**
15
	 * @inheritdoc
16
	 */
17 2
	public function display_field(array $data, array $topic_data, $view_mode)
18
	{
19 2
		return make_clickable($data['field_value']);
20
	}
21
22
	/**
23
	 * @inheritdoc
24
	 */
25 4
	public function get_validation_rules(array $data)
26
	{
27
		return array(
28 4
			'filter'	=> FILTER_VALIDATE_REGEXP,
29 4
			'options'	=> array(
30
				'options'	=> array(
31
					'regexp'	=> '#^' . get_preg_expression('url_http') . '$#iu',
32
				),
33
			),
34
		);
35 5
	}
36
37 5
	/**
38
	 * @inheritdoc
39
	 */
40
	public function get_name()
41
	{
42
		return 'url';
43
	}
44
}
45