Match   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
c 3
b 0
f 0
lcom 1
cbo 0
dl 0
loc 46
ccs 0
cts 27
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A setNamespace() 0 6 1
A setController() 0 6 1
A setAction() 0 4 1
A getSegments() 0 4 1
1
<?php
2
/**
3
 * @package    Fuel\Routing
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2015 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
namespace Fuel\Routing;
12
13
class Match
14
{
15
	public $uri;
16
	public $name;
17
	public $action;
18
	public $method;
19
	public $translation;
20
	public $parameters;
21
	public $response;
22
	public $namespace;
23
	public $controller;
24
25
	public function __construct(Route $route = null, $method, $uri, $translation, array $parameters = array(), $name = null)
26
	{
27
		$this->uri = $uri;
28
		$this->name = $name;
29
		$this->route = $route;
0 ignored issues
show
Bug introduced by
The property route does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
30
		$this->method = $method;
31
		$this->translation = $translation;
32
		$this->parameters = $parameters;
33
	}
34
35
	public function setNamespace($namespace)
36
	{
37
		$this->namespace = trim($namespace, '\\').'\\';
38
39
		return $this;
40
	}
41
42
	public function setController($controller)
43
	{
44
		$this->controller = trim($controller, '\\');
45
46
		return $this;
47
	}
48
49
	public function setAction($action)
50
	{
51
		$this->action = $action;
52
	}
53
54
	public function getSegments()
55
	{
56
		return explode('/', $this->uri);
57
	}
58
}
59