ProcedureActionTrait::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Conveyor\Actions\Traits;
4
5
/**
6
 * Action's Trait for Controller similar procedures.
7
 */
8
9
trait ProcedureActionTrait
10
{
11
    /**
12
     * @param array $data
13
     */
14
    public function __invoke(array $data)
15
    {
16
        $this->validateData($data);
0 ignored issues
show
Bug introduced by
It seems like validateData() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

16
        $this->/** @scrutinizer ignore-call */ 
17
               validateData($data);
Loading history...
17
18
        $this->data = $data;
0 ignored issues
show
Bug Best Practice introduced by
The property data does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
19
20
        return $this->execute();
0 ignored issues
show
Bug introduced by
It seems like execute() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

20
        return $this->/** @scrutinizer ignore-call */ execute();
Loading history...
21
    }
22
}
23