Completed
Push — master ( ca7ebd...ffd42a )
by Nikolas
03:40
created

Template   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A render() 0 8 1
1
<?php
2
namespace rtens\domin\delivery\web\resources;
3
4
class Template {
5
6
    /** @var string */
7
    private $file;
8
9
    /**
10
     * @param string $file
11
     */
12
    public function __construct($file) {
13
        $this->file = $file;
14
    }
15
16
    public function render($viewModel) {
17
        global $model;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
18
        $model = $viewModel;
19
20
        ob_start();
21
        include $this->file;
22
        return ob_get_clean();
23
    }
24
}