TicketsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 17 1
A validationDefault() 0 13 1
1
<?php
0 ignored issues
show
Coding Style introduced by
Class found in ".php" file; use ".inc" extension instead
Loading history...
Coding Style introduced by
Filename "TicketsTable.php" doesn't match the expected filename "ticketstable.php"
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
This file is missing a doc comment.
Loading history...
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Model\Table;
4
5
use Cake\ORM\Query;
0 ignored issues
show
introduced by
Unused use statement
Loading history...
6
use Cake\ORM\RulesChecker;
0 ignored issues
show
introduced by
Unused use statement
Loading history...
7
use Cake\ORM\Table;
8
use Cake\Validation\Validator;
9
10
/**
11
 * Tickets Model
12
 *
13
 * @property \Cake\ORM\Association\HasMany $Operations
14
 *
15
 * @method \App\Model\Entity\Ticket get($primaryKey, $options = [])
16
 * @method \App\Model\Entity\Ticket newEntity($data = null, array $options = [])
17
 * @method \App\Model\Entity\Ticket[] newEntities(array $data, array $options = [])
18
 * @method \App\Model\Entity\Ticket|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
19
 * @method \App\Model\Entity\Ticket patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
20
 * @method \App\Model\Entity\Ticket[] patchEntities($entities, array $data, array $options = [])
21
 * @method \App\Model\Entity\Ticket findOrCreate($search, callable $callback = null, $options = [])
22
 *
23
 * @mixin \Cake\ORM\Behavior\TimestampBehavior
24
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
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 @link tag in class comment
Loading history...
25
class TicketsTable extends Table {
0 ignored issues
show
Coding Style introduced by
Opening brace of a class must be on the line after the definition
Loading history...
26
27
    /**
28
     * Initialize method
29
     *
30
     * @param array $config The configuration for the Table.
0 ignored issues
show
introduced by
Parameter comment must be on the next line
Loading history...
31
     * @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...
32
     */
33 7
    public function initialize(array $config): void {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
34 7
        parent::initialize($config);
35
36 7
        $this->setTable('tickets');
37 7
        $this->setDisplayField('title');
38 7
        $this->setPrimaryKey('id');
39
40 7
        $this->addBehavior('Timestamp');
41
42 7
        $this->hasMany('Operations', [
43 7
            'foreignKey' => 'ticket_id'
0 ignored issues
show
introduced by
A comma should follow the last multiline array item. Found: 'ticket_id'
Loading history...
44
        ]);
45 7
        $this->belongsTo('Tickettypes', [
46 7
            'foreignKey' => 'tickettype_id'
0 ignored issues
show
introduced by
A comma should follow the last multiline array item. Found: 'tickettype_id'
Loading history...
47
        ]);
48 7
        $this->belongsTo('Ticketstatuses', [
49 7
            'foreignKey' => 'ticketstatus_id'
0 ignored issues
show
introduced by
A comma should follow the last multiline array item. Found: 'ticketstatus_id'
Loading history...
50
        ]);
51 7
    }
52
53
    /**
54
     * Default validation rules.
55
     *
56
     * @param \Cake\Validation\Validator $validator Validator instance.
0 ignored issues
show
introduced by
Parameter comment must be on the next line
Loading history...
57
     * @return \Cake\Validation\Validator
0 ignored issues
show
introduced by
Separate the @param and @return sections by a blank line.
Loading history...
58
     */
59 3
    public function validationDefault(Validator $validator): Validator {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
60
        //$validator
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Coding Style introduced by
No space found before comment text; expected "// $validator" but found "//$validator"
Loading history...
61
        //        ->integer('id')
0 ignored issues
show
Coding Style introduced by
Expected 1 space before comment text but found 8; use block comment if you need indentation
Loading history...
62
        //        ->allowEmptyFor('id', 'create');
0 ignored issues
show
Coding Style introduced by
Expected 1 space before comment text but found 8; use block comment if you need indentation
Loading history...
introduced by
There must be no blank line following an inline comment
Loading history...
63
64
        $validator
65 3
                ->requirePresence('title', 'create')
0 ignored issues
show
introduced by
Object operator not indented correctly; expected 10 spaces but found 16
Loading history...
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
Coding Style introduced by
Space found before object operator
Loading history...
66 3
                ->notEmptyString('title');
0 ignored issues
show
Coding Style introduced by
Space found before object operator
Loading history...
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
67
68
        $validator
69 3
                ->allowEmptyString('title', 'create');
0 ignored issues
show
introduced by
Object operator not indented correctly; expected 10 spaces but found 16
Loading history...
Coding Style introduced by
Space found before object operator
Loading history...
70
71 3
        return $validator;
72
    }
73
74
}
75