Total Complexity | 8 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
11 | class GenericBulkAction extends AbstractBulkAction |
||
12 | { |
||
13 | protected string $name = ''; |
||
14 | protected string $label = ''; |
||
15 | protected $callable = null; |
||
16 | protected bool $xhr = true; |
||
17 | |||
18 | public function __construct($name, $label, $callable = null) |
||
19 | { |
||
20 | parent::__construct(); |
||
21 | |||
22 | $this->name = $name; |
||
23 | $this->label = $label; |
||
24 | |||
25 | if ($callable) { |
||
26 | $this->callable = $callable; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | public function getI18nLabel(): string |
||
31 | { |
||
32 | return $this->getLabel(); |
||
33 | } |
||
34 | |||
35 | public function process(HTTPRequest $request): string |
||
36 | { |
||
37 | $records = $this->getRecords() ?? []; |
||
|
|||
38 | $i = 0; |
||
39 | foreach ($records as $record) { |
||
40 | if ($this->callable) { |
||
41 | $this->callable($record, $this->tabulatorGrid); |
||
42 | } |
||
43 | $i++; |
||
44 | } |
||
45 | $result = _t(__CLASS__ . ".RECORDSPROCSSED", "{count} records processed", ["count" => $i]); |
||
46 | return $result; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Get the value of callable |
||
51 | */ |
||
52 | public function getCallable() |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Set the value of callable |
||
59 | * |
||
60 | * @param callable $callable |
||
61 | */ |
||
62 | public function setCallable($callable): self |
||
66 | } |
||
67 | } |
||
68 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.