Completed
Branch master (b4ab83)
by Mikołaj
03:16
created

AddForm::setModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Rudolf\Modules\Galleries\One\Admin;
4
5
use Rudolf\Component\Alerts\Alert;
6
use Rudolf\Component\Alerts\AlertsCollection;
7
8 View Code Duplication
class AddForm extends FormCheck
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var AddModel
12
     */
13
    protected $model;
14
15
    public function setModel(AddModel $model)
16
    {
17
        $this->model = $model;
18
    }
19
20
    /**
21
     * @return int
22
     */
23
    public function add()
24
    {
25
        $status = $this->model->add($this->dataValidated);
0 ignored issues
show
Bug introduced by
The property dataValidated does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
26
27
        if ($status) {
28
            AlertsCollection::add(new Alert(
29
                'success', 'Pomyślnie dodano galerię.'
30
            ));
31
        }
32
33
        return $status;
34
    }
35
}
36