MongoProperty   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 42.86%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 73
ccs 9
cts 21
cp 0.4286
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A lessThan() 0 4 1
A lessThanEquals() 0 4 1
A greaterThan() 0 4 1
A greaterThanEquals() 0 4 1
A is() 0 4 1
A isNot() 0 4 1
A in() 0 4 1
A notIn() 0 4 1
A getName() 0 4 1
1
<?php
2
/**
3
 * This file is part of the SmartGecko(c) business platform.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Governor\Framework\EventStore\Mongo\Criteria;
10
11
use Governor\Framework\EventStore\Management\PropertyInterface;
12
13
14
/**
15
 * Property implementation for use by the Mongo Event Store.
16
 *
17
 * @author    "David Kalosi" <[email protected]>
18
 * @license   <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>
19
 */
20
class MongoProperty implements PropertyInterface
21
{
22
23
    private $propertyName;
24
25
    /**
26
     * Initialize a property for the given <code>propertyName</code>.
27
     *
28
     * @param string $propertyName The name of the property of the Mongo document.
29
     */
30 6
    public function __construct($propertyName)
31
    {
32 6
        $this->propertyName = $propertyName;
33 6
    }
34
35
36
    public function lessThan($expression)
37
    {
38
        return new SimpleMongoOperator($this, '$lt', $expression);
39
    }
40
41
42
    public function lessThanEquals($expression)
43
    {
44
        return new SimpleMongoOperator($this, '$lte', $expression);
45
    }
46
47
48
    public function greaterThan($expression)
49
    {
50
        return new SimpleMongoOperator($this, '$gt', $expression);
51
    }
52
53
54
    public function greaterThanEquals($expression)
55
    {
56
        return new SimpleMongoOperator($this, '$gte', $expression);
57
    }
58
59
60
    public function is($expression)
61
    {
62
        return new Equals($this, $expression);
63
    }
64
65
66
    public function isNot($expression)
67
    {
68
        return new SimpleMongoOperator($this, '$ne', $expression);
69
    }
70
71
72 2
    public function in($expression)
73
    {
74 2
        return new CollectionCriteria($this, '$in', $expression);
75
    }
76
77
78 1
    public function notIn($expression)
79
    {
80 1
        return new CollectionCriteria($this, '$nin', $expression);
81
    }
82
83
    /**
84
     * Returns the name of the property.
85
     *
86
     * @return string the name of the property
87
     */
88 5
    public function getName()
89
    {
90 5
        return $this->propertyName;
91
    }
92
}