Passed
Push — master ( aaffa4...1570ce )
by mazen
03:31 queued 01:59
created

ArrayPrettifier   A

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\NotEmoji\Entities\File;
0 ignored issues
show
Bug introduced by
The type MazenTouati\NotEmoji\Entities\File was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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)
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