Test Failed
Push — master ( 3b4c09...efb6fb )
by Richard
02:50
created

Factory   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 110
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 12

Importance

Changes 0
Metric Value
wmc 13
lcom 0
cbo 12
dl 0
loc 110
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A root() 0 3 1
A explanation() 0 3 1
A name() 0 3 1
A atom() 0 3 1
A string_value() 0 3 1
A property() 0 3 1
A except() 0 3 1
A any() 0 3 1
A assignment() 0 3 1
A must() 0 3 1
A cannot() 0 3 1
A only_X_can() 0 3 1
A rule() 0 3 1
1
<?php
2
/******************************************************************************
3
 * An implementation of dicto (scg.unibe.ch/dicto) in and for PHP.
4
 *
5
 * Copyright (c) 2016, 2015 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\AST;
12
13
/**
14
 * Factory for AST nodes.
15
 */
16
class Factory extends Node {
17
    /**
18
     * @param   Line[]  $lines
19
     * @return  Root
20
     */
21
    public function root(array $lines) {  
22
        return new Root($lines);
23
    }
24
25
    /**
26
     * @param   string  $content
27
     * @return  Explanation
28
     */
29
    public function explanation($content) {
30
        return new Explanation($content);
31
    }
32
33
    /**
34
     * @param   string  $name
35
     * @return  Name
36
     */
37
    public function name($name) {
38
        return new Name($name);
39
    }
40
41
    /**
42
     * @param   string  $atom
43
     * @return  Name
44
     */
45
    public function atom($atom) {
46
        return new Atom($atom);
47
    }
48
49
    /**
50
     * @param   string  $string
51
     * @return  StringValue
52
     */
53
    public function string_value($string) {
54
        return new StringValue($string);
55
    }
56
57
    /**
58
     * @param   Definition  $left
59
     * @param   Atom        $id
60
     * @param   Parameter[] $parameters
61
     * @return  Property
62
     */
63
    public function property(Definition $left, Atom $id, array $parameters) {
64
        return new Property($left, $id, $parameters);
65
    }
66
67
    /**
68
     * @param   Definition  $left
69
     * @param   Definition  $right
70
     * @return  Except
71
     */
72
    public function except(Definition $left, Definition $right) {
73
        return new Except($left, $right);
74
    }
75
76
    /**
77
     * @param   Definition[] $definitions
78
     * @return  Any
79
     * @return  Any
80
     */
81
    public function any(array $definitions) {
82
        return new Any($definitions);
83
    }
84
85
    /**
86
     * @param   Name        $name
87
     * @param   Definition  $definition
88
     * @return  Assignment
89
     */
90
    public function assignment(Name $name, Definition $definition) {
91
        return new Assignment($name, $definition);
92
    }
93
94
    /**
95
     * @return  Qualifier
96
     */
97
    public function must() {
98
        return new Qualifier(Qualifier::MUST);
99
    }
100
101
    /**
102
     * @return  Qualifier
103
     */
104
    public function cannot() {
105
        return new Qualifier(Qualifier::CANNOT);
106
    }
107
108
    /**
109
     * @return  Qualifier
110
     */
111
    public function only_X_can() {
112
        return new Qualifier(Qualifier::ONLY_X_CAN);
113
    }
114
115
    /**
116
     * @param   Definition  $left
0 ignored issues
show
Bug introduced by
There is no parameter named $left. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
117
     * @param   Qualifier   $qualifier
118
     * @param   Atom        $id
0 ignored issues
show
Bug introduced by
There is no parameter named $id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
119
     * @param   Parameter[] $parameters
0 ignored issues
show
Bug introduced by
There is no parameter named $parameters. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
120
     * @return  Property
121
     */
122
    public function rule(Qualifier $qualifier, Definition $definition) {
123
        return new Rule($qualifier, $definition);
124
    }
125
}
126