Kohana_Jam_Exception_Validation::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 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