EmptyFinderEvents::afterCount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * This software package is licensed under AGPL or Commercial license.
5
 *
6
 * @package maslosoft/mangan
7
 * @licence AGPL or Commercial
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]>
9
 * @copyright Copyright (c) Maslosoft
10
 * @copyright Copyright (c) Others as mentioned in code
11
 * @link https://maslosoft.com/mangan/
12
 */
13
14
namespace Maslosoft\Mangan\Helpers;
15
16
use Maslosoft\Addendum\Interfaces\AnnotatedInterface;
17
use Maslosoft\Mangan\Events\Event;
18
use Maslosoft\Mangan\Events\ModelEvent;
19
use Maslosoft\Mangan\Interfaces\FinderEventsInterface;
20
use Maslosoft\Mangan\Interfaces\FinderInterface;
21
use Maslosoft\Mangan\Interfaces\ModelAwareInterface;
22
23
/**
24
 * EmptyFinderEvents prevents triggering any events at all.
25
 * This is for special cases.
26
 *
27
 * @internal
28
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
29
 */
30
class EmptyFinderEvents implements FinderEventsInterface
31
{
32
33
	public function afterCount(FinderInterface $finder)
34
	{
35
	}
36
37
	public function afterExists(FinderInterface $finder)
38
	{
39
	}
40
41
	public function afterFind(FinderInterface $finder, AnnotatedInterface $model)
42
	{
43
	}
44
45
	/**
46
	 * Trigger before count event
47
	 * @return boolean
48
	 */
49
	public function beforeCount(FinderInterface $finder)
50
	{
51
		return true;
52
	}
53
54
	/**
55
	 * Trigger before exists event
56
	 * @return boolean
57
	 */
58
	public function beforeExists(FinderInterface $finder)
59
	{
60
		return true;
61
	}
62
63
	/**
64
	 * Trigger before find event
65
	 * @return boolean
66
	 */
67
	public function beforeFind(FinderInterface $finder)
68
	{
69
		return true;
70
	}
71
}
72