Strings   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilters() 0 24 1
A getFunctions() 0 7 1
A getName() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of TwigView.
6
 *
7
 ** (c) 2014 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\TwigView\Lib\Twig\Extension;
14
15
use Twig\Extension\AbstractExtension;
16
use Twig\TwigFilter;
17
use Twig\TwigFunction;
18
19
/**
20
 * Class Strings.
21
 * @package WyriHaximus\TwigView\Lib\Twig\Extension
22
 */
23
final class Strings extends AbstractExtension
24
{
25
    /**
26
     * Get declared filters.
27
     *
28
     * @return \Twig\TwigFilter[]
29
     */
30 18
    public function getFilters(): array
31
    {
32
        return [
33 18
            new TwigFilter('substr', 'substr'),
34 18
            new TwigFilter('tokenize', 'Cake\Utility\Text::tokenize'),
35 18
            new TwigFilter('insert', 'Cake\Utility\Text::insert'),
36 18
            new TwigFilter('cleanInsert', 'Cake\Utility\Text::cleanInsert'),
37 18
            new TwigFilter('wrap', 'Cake\Utility\Text::wrap'),
38 18
            new TwigFilter('wrapBlock', 'Cake\Utility\Text::wrapBlock'),
39 18
            new TwigFilter('wordWrap', 'Cake\Utility\Text::wordWrap'),
40 18
            new TwigFilter('highlight', 'Cake\Utility\Text::highlight'),
41 18
            new TwigFilter('tail', 'Cake\Utility\Text::tail'),
42 18
            new TwigFilter('truncate', 'Cake\Utility\Text::truncate'),
43 18
            new TwigFilter('excerpt', 'Cake\Utility\Text::excerpt'),
44 18
            new TwigFilter('toList', 'Cake\Utility\Text::toList'),
45 18
            new TwigFilter('isMultibyte', 'Cake\Utility\Text::isMultibyte'),
46 18
            new TwigFilter('utf8', 'Cake\Utility\Text::utf8'),
47 18
            new TwigFilter('ascii', 'Cake\Utility\Text::ascii'),
48 18
            new TwigFilter('parseFileSize', 'Cake\Utility\Text::parseFileSize'),
49
            new TwigFilter('none', function ($string) {
0 ignored issues
show
Unused Code introduced by
The parameter $string is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50 1
                return;
51 18
            }),
52
        ];
53
    }
54
55
    /**
56
     * Get declared functions.
57
     *
58
     * @return \Twig\TwigFunction[]
59
     */
60 1
    public function getFunctions(): array
61
    {
62
        return [
63 1
            new TwigFunction('uuid', 'Cake\Utility\Text::uuid'),
64 1
            new TwigFunction('sprintf', 'sprintf'),
65
        ];
66
    }
67
68
    /**
69
     * Get extension name.
70
     *
71
     * @return string
72
     */
73 1
    public function getName(): string
74
    {
75 1
        return 'string';
76
    }
77
}
78