HooksToString   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A addHookToString() 0 7 2
1
<?php
2
/*
3
 * Copyright (C) 2015 Michael Herold <[email protected]>
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace hemio\html\Trait_;
20
21
trait HooksToString
22
{
23
    /**
24
     *
25
     * @var array[callable]
26
     */
27
    protected $hooksToString = [];
28
29
    /**
30
     *
31
     * @param callable $hook
32
     * @param string $idx
33
     */
34
    public function addHookToString(callable $hook, $idx = null)
35
    {
36
        if ($idx === null)
37
            $this->hooksToString[]     = $hook;
38
        else
39
            $this->hooksToString[$idx] = $hook;
40
    }
41
}
42