ModelBindings   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 32
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fetch_records() 0 4 1
A fetch_record() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\Binding\Facets;
13
14
use ICanBoogie\ActiveRecord;
15
use ICanBoogie\Facets\CriterionList;
16
use ICanBoogie\Facets\Fetcher;
17
use ICanBoogie\Facets\RecordCollection;
18
19
/**
20
 * {@link ActiveRecord\Model} prototype bindings.
21
 *
22
 * @property-read array $criteria
23
 * @property-read CriterionList $criterion_list
24
 */
25
trait ModelBindings
26
{
27
	/**
28
	 * Fetches the records matching the specified conditions.
29
	 *
30
	 * A {@link Fetcher} instance is used to fetch the records.
31
	 *
32
	 * @param array $conditions
33
	 *
34
	 * @return RecordCollection
35
	 */
36
	public function fetch_records(array $conditions)
37
	{
38
		return parent::fetch_records($conditions);
39
	}
40
41
	/**
42
	 * Fetches a record matching the specified conditions.
43
	 *
44
	 * The model's {@link fetch_records} prototype method is used to retrieve the record.
45
	 *
46
	 * @param array $conditions
47
	 * @param Fetcher $fetcher If the parameter `fetcher` is present, the {@link Fetcher}
48
	 * instance created to fetch the record is stored inside.
49
	 *
50
	 * @return ActiveRecord|null
51
	 */
52
	public function fetch_record(array $conditions, &$fetcher = null)
53
	{
54
		return parent::fetch_record($conditions, $fetcher);
55
	}
56
}
57