Kohana_Model_Collection_Promotion::not_expired()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 1
crap 2
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
/**
4
 * @package    openbuildings\promotions
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_Collection_Promotion extends Jam_Query_Builder_Collection {
10
11 1
	public function not_expired($current_time = NULL)
12
	{
13
		return $this
14 1
			->where_open()
15 1
				->where('expires_at', '=', NULL)
16 1
				->or_where('expires_at', '>=', date('Y-m-d H:i:s', $current_time ?: time()))
17 1
			->where_close();
18
	}
19
}
20