Kohana_Jam_Exception_Validation   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 24
ccs 6
cts 10
cp 0.6
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A model() 0 4 1
A errors() 0 4 1
1
<?php defined('SYSPATH') OR die('No direct access allowed.');
2
3
/**
4
 * Resource_Jam_Exception_NotLoaded class
5
 * Jam NotLoaded Exception
6
 *
7
 * @package    Despark/http-resource
8
 * @author     Haralan Dobrev
9
 * @copyright  (c) 2012 Despark Ltd.
10
 * @license    http://creativecommons.org/licenses/by-sa/3.0/legalcode
11
 */
12
class Kohana_Jam_Exception_Validation extends Kohana_Exception {
13
14
	protected $_model;
15
16 1
	function __construct($message, $model, $fields = NULL)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
17
	{
18 1
		$this->_model = $model;
19
20 1
		$fields[':model'] = $model->meta()->model();
21 1
		$fields[':errors'] = join(', ', $model->errors()->messages_all());
22
23 1
		parent::__construct($message, $fields);
24 1
	}
25
26
	public function model()
27
	{
28
		return $this->_model;
29
	}
30
31
	public function errors()
32
	{
33
		return $this->_model->errors();
34
	}
35
}
36