GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ConfigurableFormatter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A split() 0 4 1
A join() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the "php-ipfs" package.
7
 *
8
 * (c) Robert Schönthal <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace IPFS\Utils;
15
16
use Camel\Format\FormatInterface;
17
18
class ConfigurableFormatter implements FormatInterface
19
{
20
    /**
21
     * @var string
22
     */
23
    private $delimiter;
24
25 11
    public function __construct(string $delimiter)
26
    {
27 11
        $this->delimiter = $delimiter;
28 11
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 6
    public function split($word)
34
    {
35 6
        return explode($this->delimiter, $word);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 8
    public function join(array $words)
42
    {
43
        // Ensure words are lowercase
44 8
        $words = array_map('strtolower', $words);
45
46 8
        return implode($this->delimiter, $words);
47
    }
48
}
49