Completed
Push — master ( b93a87...00392a )
by Richard
05:47
created

Definition::withExplanation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 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
     * @param   string
24
     * return   self
25
     */
26 120
    public function withExplanation($explanation) {
27 120
        $clone = clone $this;
28 120
        $clone->explanation = $explanation;
29 120
        return $clone;
30
    }
31
32
    /**
33
     * @return  string
34
     */
35 122
    public function explanation() {
36 122
        return $this->explanation;
37
    }
38
}
39
40