CategoryForm   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 19 1
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
}