DocumentsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 39
ccs 0
cts 15
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validationDefault() 0 13 1
A initialize() 0 9 1
1
<?php
0 ignored issues
show
Coding Style introduced by
Header blocks must be separated by a single blank line
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "DocumentsTable.php" doesn't match the expected filename "documentstable.php"
Loading history...
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
Class found in ".php" file; use ".inc" extension instead
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;
0 ignored issues
show
introduced by
Unused use statement
Loading history...
6
use Cake\ORM\Table;
7
use Cake\Validation\Validator;
8
9
/**
10
 * Documents Model
11
 *
12
 * @method \App\Model\Entity\Document get($primaryKey, $options = [])
13
 * @method \App\Model\Entity\Document newEntity($data = null, array $options = [])
14
 * @method \App\Model\Entity\Document[] newEntities(array $data, array $options = [])
15
 * @method \App\Model\Entity\Document|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
16
 * @method \App\Model\Entity\Document patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
17
 * @method \App\Model\Entity\Document[] patchEntities($entities, array $data, array $options = [])
18
 * @method \App\Model\Entity\Document 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 @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
22
class DocumentsTable extends Table
23
{
0 ignored issues
show
introduced by
Opening brace should be on the same line as the declaration
Loading history...
Coding Style introduced by
Opening brace should be on the same line as the declaration for class DocumentsTable
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
Separate the @param and @return sections by a blank line.
Loading history...
introduced by
If there is no return value for a function, there must not be a @return tag.
Loading history...
30
     */
31
    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
        parent::initialize($config);
34
35
        $this->setTable('documents');
36
        $this->setDisplayField('name');
37
        $this->setPrimaryKey('id');
38
39
        $this->addBehavior('Timestamp');
40
    }
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...
50
        $validator
51
            ->integer('id')
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
introduced by
Object operator not indented correctly; expected 10 spaces but found 12
Loading history...
52
            ->allowEmpty('id', 'create');
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
53
54
        $validator
55
            ->scalar('name')
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...
56
            ->maxLength('name', 255)
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
57
            ->requirePresence('name', 'create')
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
58
            ->notEmpty('name');
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
59
60
        return $validator;
61
    }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
62
}
63