Code Duplication    Length = 35-35 lines in 5 locations

app/module/Albums/One/Admin/DelForm.php 1 location

@@ 9-43 (lines=35) @@
6
use Rudolf\Component\Alerts\AlertsCollection;
7
use Rudolf\Component\Forms\Form;
8
9
class DelForm extends Form
10
{
11
    /**
12
     * @var DelModel
13
     */
14
    protected $model;
15
16
    public function setModel(DelModel $model)
17
    {
18
        $this->model = $model;
19
    }
20
21
    public function check()
22
    {
23
        $this->validator
24
            ->checkIsInt('id', $this->data['id'], [
25
                'not_int' => _('Album ID is not valid'),
26
            ]);
27
28
        $this->id = $this->data['id'];
29
    }
30
31
    public function delete()
32
    {
33
        $status = $this->model->delete($this->id);
34
35
        if ($status) {
36
            AlertsCollection::add(new Alert(
37
                'success', 'Pomyślnie usunięto album.'
38
            ));
39
        }
40
41
        return $status;
42
    }
43
}
44

app/module/Articles/One/Admin/DelForm.php 1 location

@@ 9-43 (lines=35) @@
6
use Rudolf\Component\Alerts\AlertsCollection;
7
use Rudolf\Component\Forms\Form;
8
9
class DelForm extends Form
10
{
11
    /**
12
     * @var DelModel
13
     */
14
    protected $model;
15
16
    public function setModel(DelModel $model)
17
    {
18
        $this->model = $model;
19
    }
20
21
    public function check()
22
    {
23
        $this->validator
24
            ->checkIsInt('id', $this->data['id'], [
25
                'not_int' => _('Article ID is not valid'),
26
            ]);
27
28
        $this->id = $this->data['id'];
29
    }
30
31
    public function delete()
32
    {
33
        $status = $this->model->delete($this->id);
34
35
        if ($status) {
36
            AlertsCollection::add(new Alert(
37
                'success', 'Pomyślnie usunięto artykuł.'
38
            ));
39
        }
40
41
        return $status;
42
    }
43
}
44

app/module/Categories/One/Admin/DelForm.php 1 location

@@ 9-43 (lines=35) @@
6
use Rudolf\Component\Alerts\AlertsCollection;
7
use Rudolf\Component\Forms\Form;
8
9
class DelForm extends Form
10
{
11
    /**
12
     * @var DelModel
13
     */
14
    protected $model;
15
16
    public function setModel(DelModel $model)
17
    {
18
        $this->model = $model;
19
    }
20
21
    public function check()
22
    {
23
        $this->validator
24
            ->checkIsInt('id', $this->data['id'], [
25
                'not_int' => _('Category ID is not valid'),
26
            ]);
27
28
        $this->id = $this->data['id'];
29
    }
30
31
    public function delete()
32
    {
33
        $status = $this->model->delete($this->id);
34
35
        if ($status) {
36
            AlertsCollection::add(new Alert(
37
                'success', 'Pomyślnie usunięto kategorię.'
38
            ));
39
        }
40
41
        return $status;
42
    }
43
}
44

app/module/Galleries/One/Admin/DelForm.php 1 location

@@ 9-43 (lines=35) @@
6
use Rudolf\Component\Alerts\Alert;
7
use Rudolf\Component\Alerts\AlertsCollection;
8
9
class DelForm extends Form
10
{
11
    /**
12
     * @var DelModel
13
     */
14
    protected $model;
15
16
    public function setModel(DelModel $model)
17
    {
18
        $this->model = $model;
19
    }
20
21
    public function check()
22
    {
23
        $this->validator
24
            ->checkIsInt('id', $this->data['id'], [
25
                'not_int' => _('Page ID is not valid'),
26
            ]);
27
28
        $this->id = $this->data['id'];
29
    }
30
31
    public function delete()
32
    {
33
        $status = $this->model->delete($this->id);
34
35
        if ($status) {
36
            AlertsCollection::add(new Alert(
37
                'success', 'Pomyślnie usunięto galerię.'
38
            ));
39
        }
40
41
        return $status;
42
    }
43
}
44

app/module/Pages/One/Admin/DelForm.php 1 location

@@ 9-43 (lines=35) @@
6
use Rudolf\Component\Alerts\Alert;
7
use Rudolf\Component\Alerts\AlertsCollection;
8
9
class DelForm extends Form
10
{
11
    /**
12
     * @var DelModel
13
     */
14
    protected $model;
15
16
    public function setModel(DelModel $model)
17
    {
18
        $this->model = $model;
19
    }
20
21
    public function check()
22
    {
23
        $this->validator
24
            ->checkIsInt('id', $this->data['id'], [
25
                'not_int' => _('Page ID is not valid'),
26
            ]);
27
28
        $this->id = $this->data['id'];
29
    }
30
31
    public function delete()
32
    {
33
        $status = $this->model->delete($this->id);
34
35
        if ($status) {
36
            AlertsCollection::add(new Alert(
37
                'success', 'Pomyślnie usunięto stronę.'
38
            ));
39
        }
40
41
        return $status;
42
    }
43
}
44