Completed
Push — master ( cc2765...340ff8 )
by Richard
08:19
created

Definition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A explain() 0 5 1
A explanation() 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\Definition;
12
13
/**
14
 * Base class for all definitions. 
15
 */
16
abstract class Definition {
17
    /**
18
     * @var string|null
19
     */
20
    private $explanation = null;
21
22
    /**
23
     * TODO: rename to withExplanation
24
     * @param   string
25
     * return   self
26
     */
27 115
    public function explain($explanation) {
28 115
        $clone = clone $this;
29 115
        $clone->explanation = $explanation;
30 115
        return $clone;
31
    }
32
33
    /**
34
     * @return  string
35
     */
36 115
    public function explanation() {
37 115
        return $this->explanation;
38
    }
39
}
40
41