Completed
Push — master ( a94ac3...322d21 )
by Richard
05:34
created

Ruleset   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 33
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A variables() 0 3 1
A rules() 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 licence along with the code.
9
 */
10
11
namespace Lechimp\Dicto\Rules;
12
13
use Lechimp\Dicto\Variables\Variable;
14
15
/**
16
 * A set of rules and variable definitions.
17
 */
18
class Ruleset {
19
    /**
20
     * @var Variables\Variable[]
21
     */
22
    private $variables;
23
24
    /**
25
     * @var Rule[]  $rules
26
     */
27
    private $rules;
28
29 280
    public function __construct(array $variables, array $rules) {
30
        $this->variables = array_map(function (Variable $v)
31 280
                                        { return $v; }, $variables);
32
33 280
        $this->rules = array_map(function (Rule $r)
34 280
                                        { return $r; }, $rules);
35 280
    }
36
37
    /**
38
     * @return  Variables\Variable[]
39
     */
40 95
    public function variables() {
41 95
        return $this->variables;
42
    }
43
44
    /**
45
     * @return  Rule[]
46
     */
47 185
    public function rules() {
48 185
        return $this->rules;
49
    }
50
}
51