TestCaseHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 4
b 0
f 0
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouterGenerateFunction() 0 4 1
A getTranslatorTransFunction() 0 4 1
A getEventDispatcherDispatchFunction() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2021 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\Tests;
13
14
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
15
use Symfony\Contracts\EventDispatcher\Event;
16
17
/**
18
 * Test case helper.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Bundle\CoreBundle\Tests
22
 */
23
class TestCaseHelper {
24
25
    /**
26
     * Get dispatch() function for an event dispatcher.
27
     *
28
     * @return callable Returns dispatch() function for an event dispatcher.
29
     */
30
    public static function getEventDispatcherDispatchFunction(): callable {
31
32
        return function(Event $event, string $eventName = null): Event {
0 ignored issues
show
Unused Code introduced by
The parameter $eventName is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

32
        return function(Event $event, /** @scrutinizer ignore-unused */ string $eventName = null): Event {

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

Loading history...
33
            return $event;
34
        };
35
    }
36
37
    /**
38
     * Get generate() function for a router.
39
     *
40
     * @return callable Returns generate() function for a router.
41
     */
42
    public static function getRouterGenerateFunction(): callable {
43
44
        return function($name, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) {
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

44
        return function($name, /** @scrutinizer ignore-unused */ array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) {

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

Loading history...
Unused Code introduced by
The parameter $referenceType is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

44
        return function($name, array $parameters = [], /** @scrutinizer ignore-unused */ int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) {

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

Loading history...
45
            return $name;
46
        };
47
    }
48
49
    /**
50
     * Get a trans() function for a translator.
51
     *
52
     * @return callable Returns the trans() function for a translator.
53
     */
54
    public static function getTranslatorTransFunction(): callable {
55
56
        return function($id, array $parameters = [], string $domain = null, string $locale = null): ?string {
0 ignored issues
show
Unused Code introduced by
The parameter $parameters is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

56
        return function($id, /** @scrutinizer ignore-unused */ array $parameters = [], string $domain = null, string $locale = null): ?string {

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

Loading history...
Unused Code introduced by
The parameter $domain is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

56
        return function($id, array $parameters = [], /** @scrutinizer ignore-unused */ string $domain = null, string $locale = null): ?string {

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

Loading history...
Unused Code introduced by
The parameter $locale is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

56
        return function($id, array $parameters = [], string $domain = null, /** @scrutinizer ignore-unused */ string $locale = null): ?string {

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

Loading history...
57
            return $id;
58
        };
59
    }
60
}
61