Completed
Push — develop ( dfba50...3f30aa )
by Tino
07:19
created

Delete::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright (c) by the ACP3 Developers.
5
 * See the LICENSE file at the top-level module directory for licensing details.
6
 */
7
8
namespace ACP3\Modules\ACP3\Contact\Controller\Admin\Index;
9
10
use ACP3\Core;
11
use ACP3\Modules\ACP3\Contact\Model\ContactsModel;
12
13
class Delete extends Core\Controller\AbstractFormAction
14
{
15
    /**
16
     * @var \ACP3\Modules\ACP3\Contact\Model\ContactsModel
17
     */
18
    private $contactsModel;
19
20
    public function __construct(
21
        Core\Controller\Context\FormContext $context,
22
        ContactsModel $contactsModel
23
    ) {
24
        parent::__construct($context);
25
26
        $this->contactsModel = $contactsModel;
27
    }
28
29
    /**
30
     * @param string $action
31
     *
32
     * @return mixed
33
     *
34
     * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
35
     */
36
    public function execute(?string $action)
37
    {
38
        return $this->actionHelper->handleDeleteAction(
39
            $action,
40
            function (array $items) {
41
                return $this->contactsModel->delete($items);
42
            }
43
        );
44
    }
45
}
46