ArrayPrettifier   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 14 2
1
<?php
2
declare(strict_types=1);
3
4
namespace MazenTouati\NoEmoji\Prettifiers;
5
6
use MazenTouati\NoEmoji\Entities\File;
7
8
/**
9
 * @author Mazen Touati <[email protected]>
10
 */
11
class ArrayPrettifier
12
{
13
    /**
14
     * Prettify the input
15
     *
16
     * @param File $file The file instance
17
     *
18
     * @return string
19
     */
20
    public static function run(File $file)
21
    {
22
        $content = trim($file->content, '\'');
23
        $ranges = explode('|', $content);
24
25
        $pretty = '[' . PHP_EOL;
26
27
        foreach ($ranges as $range) {
28
            $pretty .= "\t'". $range . "'," . PHP_EOL;
29
        }
30
31
        $pretty .= ']' . PHP_EOL;
32
33
        return $pretty;
34
    }
35
}
36