Completed
Push — master ( dd7177...241235 )
by Kacper
04:07
created

map.php ➔ asElement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 0
cts 2
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Kadet\Xmpp\Utils\map;
4
5
use Kadet\Xmpp\Xml\XmlElement;
6
7
function prepend(string $prefix) {
8
    return function($content) use ($prefix) {
9
        return $prefix . $content;
10
    };
11
}
12
13
function append(string $suffix) {
14
    return function($content) use ($suffix) {
15
        return $content . $suffix;
16
    };
17
}
18
19
function asElement(string $name, string $uri = null, $class = XmlElement::class) {
0 ignored issues
show
Unused Code introduced by
The parameter $name is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $uri is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
    return function($item) use ($class) {
21
        return new $class('group', null, ['content' => $item]);
22
    };
23
}