Completed
Push — master ( fe6838...baec05 )
by Ievgen
02:20
created

DeleteOperation::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use einfach\operation\{Railway, Result};
4
use function einfach\operation\response\{ok, error};
5
6
class DeleteOperation extends ReadOperation implements \einfach\operation\IOperation
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    public function railway() : Railway
9
    {
10
        return parent::railway()
11
            ->step([$this, 'delete']);
12
    }
13
14
    public function __invoke(array $params) : Result
15
    {
16
        return $this->railway()->runWithParams($params);
17
    }
18
19
    public function delete($params)
20
    {
21
        // pretend it is deleted from DB
22
        unset($params['model']);
23
        return ok($params);
24
    }
25
}
26