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

_Custom   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A compile() 0 3 1
A for_types() 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\Predicate;
12
13
use Lechimp\Dicto\Graph\Entity;
14
use Lechimp\Dicto\Graph\Predicate;
15
16
/**
17
 * A custom predicate on an entity.
18
 */
19
class _Custom extends Predicate {
20
    /**
21
     * @var \Closure 
22
     */
23
    protected $predicate;
24
25 39
    public function __construct(\Closure $predicate) {
26 39
        $this->predicate = $predicate;
27 39
    }
28
29
    /**
30
     * @inheritdocs
31
     */
32 36
    public function compile() {
33 36
        return $this->predicate;
34
    }
35
36
    /**
37
     * @inheritdocs
38
     */
39 17
    public function for_types($existing_types) {
40 17
        return $existing_types;
41
    }
42
}
43