BatchAdminController::batchActionBar()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\Fixtures\Controller;
15
16
use Sonata\AdminBundle\Controller\CRUDController;
17
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
18
use Symfony\Component\HttpFoundation\Response;
19
20
/**
21
 * BatchAdminController is used to test relevant batch action.
22
 */
23
class BatchAdminController extends CRUDController
24
{
25
    /**
26
     * Returns true if $idx contains 123 and 456.
27
     */
28
    public function batchActionFooIsRelevant(array $idx, $allElements)
0 ignored issues
show
Unused Code introduced by
The parameter $allElements 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...
29
    {
30
        if (isset($idx[0], $idx[1]) && 123 === $idx[0] && 456 === $idx[1]) {
31
            return true;
32
        }
33
34
        if (isset($idx[0]) && 999 === $idx[0]) {
35
            return 'flash_foo_error';
36
        }
37
38
        return false;
39
    }
40
41
    public function batchActionFoo(ProxyQueryInterface $query): void
0 ignored issues
show
Unused Code introduced by
The parameter $query 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...
42
    {
43
    }
44
45
    public function batchActionBarIsRelevant(array $idx, $allElements)
0 ignored issues
show
Unused Code introduced by
The parameter $idx 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...
Unused Code introduced by
The parameter $allElements 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...
46
    {
47
        return true;
48
    }
49
50
    public function batchActionBar(ProxyQueryInterface $query = null)
51
    {
52
        if (null === $query) {
53
            return new Response('batchActionBar executed');
54
        }
55
56
        return false;
57
    }
58
}
59