These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace App\Model\Table; |
||
3 | |||
4 | use Cake\Database\Schema\Table as Schema; |
||
5 | use Cake\ORM\Table; |
||
6 | |||
7 | class UsersTwoFactorAuthTable extends Table |
||
8 | { |
||
9 | /** |
||
10 | * Initialize schema method |
||
11 | * |
||
12 | * @param \Cake\Database\Schema\Table $schema The schema of the Table. |
||
13 | * |
||
14 | * @return \Cake\Database\Schema\Table |
||
15 | */ |
||
16 | protected function _initializeSchema(Schema $schema) |
||
17 | { |
||
18 | $schema->columnType('secret', 'encryptedsecurity'); |
||
19 | $schema->columnType('username', 'encryptedsecurity'); |
||
20 | $schema->columnType('session', 'encryptedsecurity'); |
||
21 | $schema->columnType('recovery_code', 'encryptedsecurity'); |
||
22 | |||
23 | return $schema; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Initialize method |
||
28 | * |
||
29 | * @param array $config The configuration for the Table. |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | View Code Duplication | public function initialize(array $config) |
|
0 ignored issues
–
show
|
|||
34 | { |
||
35 | parent::initialize($config); |
||
36 | |||
37 | $this->table('users_two_factor_auth'); |
||
38 | $this->displayField('id'); |
||
39 | $this->primaryKey('id'); |
||
40 | |||
41 | $this->addBehavior('Timestamp'); |
||
42 | |||
43 | $this->belongsTo('Users', [ |
||
44 | 'foreignKey' => 'user_id' |
||
45 | ]); |
||
46 | } |
||
47 | } |
||
48 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.