Completed
Push — master ( f08276...333f55 )
by Richard
06:54 queued 34s
created

Definition::explanation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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 licence 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
    public function explain($explanation) {
27
        $clone = clone $this;
28
        $clone->explanation = $explanation;
29
        return $clone;
30
    }
31
32
    /**
33
     * @return  string
34
     */
35
    public function explanation() {
36
        return $this->explanation;
37
    }
38
39
    protected function setExplanation($explanation) {
40
        assert('is_string($explanation)');
41
        $this->explanation = $explanation;
42
    }
43
}
44
45