Kohana_Model_Shipping_Method   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 24
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 18 1
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * @package    openbuildings\shipping
5
 * @author     Ivan Kerin <[email protected]>
6
 * @copyright  (c) 2013 OpenBuildings Ltd.
7
 * @license    http://spdx.org/licenses/BSD-3-Clause
8
 */
9
class Kohana_Model_Shipping_Method extends Jam_Model {
10
11
	/**
12
	 * @codeCoverageIgnore
13
	 */
14
	public static function initialize(Jam_Meta $meta)
15
	{
16
		$meta
17
			->associations(array(
18
				'brand' => Jam::association('belongsto', array('inverse_of' => 'shipping_methods')),
19
				'shippings' => Jam::association('manytomany', array(
20
					'foreign_key' => 'method_id',
21
					'join_table' => 'shipping_groups',
22
					'readonly' => TRUE,
23
				)),
24
				'shipping_groups' => Jam::association('hasmany', array('inverse_of' => 'method')),
25
			))
26
			->fields(array(
27
				'id'         => Jam::field('primary'),
28
				'name'       => Jam::field('string'),
29
			))
30
			->validator('name', array('present' => TRUE));
31
	}
32
}
33