Completed
Push — develop ( 9a2d03...4f224f )
by Nate
09:22
created

Delete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 4 1
A performAction() 0 4 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/hubspot/license
6
 * @link       https://www.flipboxfactory.com/software/hubspot/
7
 */
8
9
namespace flipbox\craft\hubspot\actions\visitors;
10
11
use flipbox\craft\ember\actions\models\DeleteModel;
12
use flipbox\craft\hubspot\records\Visitor;
13
use yii\base\Model;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.1.0
18
 */
19
class Delete extends DeleteModel
20
{
21
    /**
22
     * @param int|string $identifier
23
     * @return Visitor|mixed|null
24
     */
25
    protected function find($identifier)
26
    {
27
        return Visitor::findOne($identifier);
28
    }
29
30
    /**
31
     * @inheritDoc
32
     * @param Visitor $record
33
     * @throws \Throwable
34
     * @throws \yii\db\StaleObjectException
35
     */
36
    protected function performAction(Model $record): bool
37
    {
38
        return $record->delete();
39
    }
40
}
41