UsersTable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 58.81%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 53
ccs 10
cts 17
cp 0.5881
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 9 1
A validationDefault() 0 13 1
A buildRules() 0 5 1
1
<?php
0 ignored issues
show
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Header blocks must be separated by a single blank line
Loading history...
Coding Style introduced by
Filename "UsersTable.php" doesn't match the expected filename "userstable.php"
Loading history...
Coding Style introduced by
Class found in ".php" file; use ".inc" extension instead
Loading history...
Coding Style introduced by
This file is missing a doc comment.
Loading history...
2
namespace App\Model\Table;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Cake\ORM\Query;
0 ignored issues
show
introduced by
Unused use statement
Loading history...
5
use Cake\ORM\RulesChecker;
6
use Cake\ORM\Table;
7
use Cake\Validation\Validator;
8
9
/**
10
 * Users Model
11
 *
12
 * @method \App\Model\Entity\User get($primaryKey, $options = [])
13
 * @method \App\Model\Entity\User newEntity($data = null, array $options = [])
14
 * @method \App\Model\Entity\User[] newEntities(array $data, array $options = [])
15
 * @method \App\Model\Entity\User|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
16
 * @method \App\Model\Entity\User patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
17
 * @method \App\Model\Entity\User[] patchEntities($entities, array $data, array $options = [])
18
 * @method \App\Model\Entity\User findOrCreate($search, callable $callback = null, $options = [])
19
 *
20
 * @mixin \Cake\ORM\Behavior\TimestampBehavior
21
 */
0 ignored issues
show
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
22
class UsersTable extends Table
23
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class UsersTable
Loading history...
introduced by
Opening brace should be on the same line as the declaration
Loading history...
24
25
    /**
26
     * Initialize method
27
     *
28
     * @param array $config The configuration for the Table.
0 ignored issues
show
introduced by
Parameter comment must be on the next line
Loading history...
29
     * @return void
0 ignored issues
show
introduced by
If there is no return value for a function, there must not be a @return tag.
Loading history...
introduced by
Separate the @param and @return sections by a blank line.
Loading history...
30
     */
31 3
    public function initialize(array $config) : void
0 ignored issues
show
Coding Style introduced by
There must not be a space before the colon in a return type declaration
Loading history...
32
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
33 3
        parent::initialize($config);
34
35 3
        $this->setTable('users');
36 3
        $this->setDisplayField('id');
37 3
        $this->setPrimaryKey('id');
38
39 3
        $this->addBehavior('Timestamp');
40 3
    }
41
42
    /**
43
     * Default validation rules.
44
     *
45
     * @param \Cake\Validation\Validator $validator Validator instance.
0 ignored issues
show
introduced by
Parameter comment must be on the next line
Loading history...
46
     * @return \Cake\Validation\Validator
0 ignored issues
show
introduced by
Separate the @param and @return sections by a blank line.
Loading history...
47
     */
48
    public function validationDefault(Validator $validator) : Validator
0 ignored issues
show
Coding Style introduced by
There must not be a space before the colon in a return type declaration
Loading history...
49
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
Coding Style introduced by
Expected 0 blank lines after opening function brace; 1 found
Loading history...
50
51
        $validator
52
            ->email('email')
0 ignored issues
show
introduced by
Object operator not indented correctly; expected 10 spaces but found 12
Loading history...
Coding Style introduced by
Space found before object operator
Loading history...
53
            ->requirePresence('email', 'create')
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
54
            ->notEmpty('email');
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
55
56
        $validator
57
            ->requirePresence('password', 'create')
0 ignored issues
show
introduced by
Object operator not indented correctly; expected 10 spaces but found 12
Loading history...
Coding Style introduced by
Space found before object operator
Loading history...
58
            ->notEmpty('password');
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
59
60
        return $validator;
61
    }
62
63
    /**
64
     * Returns a rules checker object that will be used for validating
65
     * application integrity.
0 ignored issues
show
introduced by
Doc comment short description must be on a single line, further text should be a separate paragraph
Loading history...
66
     *
67
     * @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
0 ignored issues
show
introduced by
Parameter comment must be on the next line
Loading history...
68
     * @return \Cake\ORM\RulesChecker
0 ignored issues
show
introduced by
Separate the @param and @return sections by a blank line.
Loading history...
69
     */
70 1
    public function buildRules(RulesChecker $rules) : RulesChecker
0 ignored issues
show
Coding Style introduced by
There must not be a space before the colon in a return type declaration
Loading history...
71
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
72 1
        $rules->add($rules->isUnique(['email']));
73
74 1
        return $rules;
75
    }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
76
}
77