Completed
Pull Request — master (#32)
by Thomas
04:59
created

MyViewExtension::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace example\components;
4
5
use Tebe\Pvc\View\ViewExtension;
6
use Tebe\Pvc\View\View;
7
8
class MyViewExtension implements ViewExtension
9
{
10
    public function register(View $view)
11
    {
12
        $view->registerHelper('hello', function (string $name = '') {
13
            return sprintf("Hallo %s", $name);
14
        });
15
        $view->registerHelper('add', function (float ...$operands) {
16
            return array_sum($operands);
17
        });
18
    }
19
}
20