Kohana_Model_Purchase_Item_Promotion   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 15 1
A get_price() 0 5 2
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * @package    openbuildings\promotions
5
 * @author     Haralan Dobrev <[email protected]>
6
 * @copyright  2013 OpenBuildings, Inc.
7
 * @license    http://spdx.org/licenses/BSD-3-Clause
8
 */
9
class Kohana_Model_Purchase_Item_Promotion extends Model_Purchase_Item {
10
11
	/**
12
	 * @codeCoverageIgnore
13
	 */
14
	public static function initialize(Jam_Meta $meta)
15
	{
16
		parent::initialize($meta);
17
18
		$meta
19
			->table('purchase_items')
20
			->fields(array(
21
				'is_payable' => Jam::field('boolean', array(
22
					'default' => TRUE
23
				)),
24
				'is_discount' => Jam::field('boolean', array(
25
					'default' => TRUE
26
				)),
27
			));
28
	}
29
30 1
	public function get_price()
31
	{
32 1
		$reference = $this->get_reference_paranoid();
33 1
		return $reference ? $reference->price_for_purchase_item($this) : new Jam_Price(0, 'GBP');
34
	}
35
}
36