Completed
Pull Request — master (#74)
by Haralan
15:13 queued 09:33
created

Kohana_Jam_Exception_Validation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 1
eloc 5
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