GeneralExtension::getFilters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 19
rs 9.9666
1
<?php
2
3
namespace App\Twig;
4
5
use Twig\Extension\AbstractExtension;
6
use Twig\TwigFilter;
7
8
class GeneralExtension extends AbstractExtension
9
{
10
    public function getFilters(): array
11
    {
12
        return [
13
            // Times
14
            new TwigFilter('duration_to_hms', [GeneralRuntime::class, 'durationToHMS']),
15
16
            // Byte formatting
17
            new TwigFilter('format_metric_bytes', [GeneralRuntime::class, 'formatMetricBytes']),
18
            new TwigFilter('format_binary_bytes', [GeneralRuntime::class, 'formatBinaryBytes']),
19
            // Default byte formatting
20
            new TwigFilter('format_bytes', [GeneralRuntime::class, 'formatBinaryBytes']),
21
22
            // Picture rating
23
            new TwigFilter('star_rating', [GeneralRuntime::class, 'starRating']),
24
25
            // Text
26
            new TwigFilter('markdown_to_plain_text', [GeneralRuntime::class, 'markdownToPlainText']),
27
            new TwigFilter('stripmosttags', [GeneralRuntime::class, 'stripMostTags']),
28
            new TwigFilter('slugify_tag', [GeneralRuntime::class, 'slugifyTag'])
29
        ];
30
    }
31
}
32