Completed
Push — master ( 333f55...a94ac3 )
by Richard
05:33
created

Variable::_with()   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
nc 1
cc 1
eloc 2
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\Variables;
12
use Lechimp\Dicto\Definition as Def;
13
14
15
abstract class Variable extends Def\Definition {
16
    const CLASS_TYPE = "class";
17
    const FILE_TYPE = "file";
18
    const GLOBAL_TYPE = "global";
19
    const FUNCTION_TYPE = "function";
20
    const METHOD_TYPE = "method";
21
    const LANGUAGE_CONSTRUCT_TYPE = "language_construct";
22
23 68
    static public function is_type($t) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
24
        static $types = array
25
            ( "class"
26
            , "file"
27
            , "global"
28
            , "function"
29
            , "method"
30
            , "language_construct"
31 68
            );
32 68
        return in_array($t, $types);
33
    }
34
35
    /**
36
     * @var string
37
     */
38
    private $name;
39
40 339
    public function __construct($name) {
41 339
        assert('is_string($name)');
42 339
        $this->name = $name;
43 339
    }
44
45 160
    public function name() {
46 160
        return $this->name;
47
    }
48
}
49
50