CategoryForm::initialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2011 - 2015 Oleksandr Torosh (http://yonastudio.com)
4
 * @author Oleksandr Torosh <[email protected]>
5
 */
6
7
namespace Tree\Form;
8
9
use Phalcon\Forms\Element\Text;
10
use Phalcon\Validation\Validator\PresenceOf;
11
12
class CategoryForm extends \Application\Form\Form
13
{
14
15
    public function initialize()
16
    {
17
        $this->add(
18
            (new Text('slug', ['required' => 'required']))
0 ignored issues
show
Bug introduced by
The method setLabel cannot be called on (new \Phalcon\Forms\Elem...> 'Slug is required'))) (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
19
                ->addValidator(new PresenceOf([
20
                    'message' => 'Slug is required'
21
                ]))
22
                ->setLabel('Slug')
23
        );
24
25
        $this->add(
26
            (new Text('title', ['required' => 'required']))
0 ignored issues
show
Bug introduced by
The method setLabel cannot be called on (new \Phalcon\Forms\Elem... 'Title is required'))) (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
27
                ->addValidator(new PresenceOf([
28
                    'message' => 'Title is required'
29
                ]))
30
                ->setLabel('Title')
31
        );
32
33
    }
34
35
}