Completed
Push — master ( 1e9ef5...3740bc )
by Richard
05:53 queued 29s
created

PropertyPredicateFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A _matches() 0 3 1
1
<?php
2
/******************************************************************************
3
 * An implementation of dicto (scg.unibe.ch/dicto) in and for PHP.
4
 * 
5
 * Copyright (c) 2016 Richard Klees <[email protected]>
6
 *
7
 * This software is licensed under The MIT License. You should have received 
8
 * a copy of the license along with the code.
9
 */
10
11
namespace Lechimp\Dicto\Graph;
12
13
/**
14
 * Create some predicate over a property.
15
 */
16
class PropertyPredicateFactory {
17
    /**
18
     * @var string
19
     */
20
    protected $name;
21
22 30
    public function __construct($name) {
23 30
        assert('is_string($name)');
24 30
        $this->name = $name;
25 30
    }
26
27
    /**
28
     * Is true when the property matches the given regex.
29
     *
30
     * @param   string  $regex
31
     * @return  Predicate
32
     */
33 30
    public function _matches($regex) {
34 30
        return new Predicate\_PropertyMatches($this->name, $regex);
35
    }
36
}
37