Kohana_Jam_Field_Twitter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 25
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A set() 0 12 4
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * Add support for twitter usernames to Weblink field
5
 *
6
 * @package    Jam
7
 * @category   Fields
8
 * @author     Haralan Dobrev
9
 * @copyright  (c) 2012 Despark Ltd.
10
 * @license    http://www.opensource.org/licenses/isc-license.txt
11
 */
12
class Kohana_Jam_Field_Twitter extends Jam_Field_Weblink {
13
14
	/**
15
	 * If just a Twitter username is provided prefix it with 'http://twitter.com'.
16
	 * If username is provided with a '@' prefix it's stripped.
17
	 *
18
	 * @param  Jam_Model $model
19
	 * @param  string $value
20
	 * @param  boolean $loaded
0 ignored issues
show
Bug introduced by
There is no parameter named $loaded. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
21
	 * @return string
22
	 */
23 6
	public function set(Jam_Validated $model, $value, $is_changed)
24
	{
25 6
		if ($value AND strpos($value, 'twitter.com') === FALSE)
26
		{
27 2
			if (substr($value, 0, 1) === '@')
28
			{
29 1
				$value = substr($value, 1);
30
			}
31 2
			$value = 'http://twitter.com/'.$value;
32
		}
33 6
		return parent::set($model, $value, $is_changed);
34
	}
35
36
} // End Jam_Field_Twitter
37