Pattern   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toString() 0 8 1
A __toString() 0 4 1
1
<?php
2
3
namespace Openl10n\Cli\File;
4
5
class Pattern
6
{
7
    protected $pattern;
8
9
    public function __construct($pattern)
10
    {
11
        $this->pattern = $pattern;
12
    }
13
14
    public function toString(array $attributes = array())
15
    {
16
        $placeholders = array_map(function ($attribute) {
17
            return "<$attribute>";
18
        }, array_keys($attributes));
19
20
        return str_replace($placeholders, $attributes, $this->pattern);
21
    }
22
23
    public function __toString()
24
    {
25
        return $this->toString();
26
    }
27
}
28