Completed
Push — master ( 34a034...506162 )
by Jean-Bernard
03:20 queued 01:22
created

SchemaBuilder::userTable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
ccs 19
cts 19
cp 1
rs 9.2
cc 1
eloc 19
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the FOS User Util package.
5
 *
6
 * (c) Jean-Bernard Addor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FosUserUtil\Doctrine\DBAL;
13
14
use Doctrine\DBAL\Schema\Schema;
15
16
class SchemaBuilder
17
{
18
    protected $schema;
19
20 2
    public function __construct(Schema $schema)
21
    {
22 2
        $this->schema = $schema;
23 2
    }
24
25 1
    public function userTable()
26
    {
27 1
        $UserTable = $this->schema->createTable('http_user');
28 1
        $UserTable->addColumn('uuid', 'guid');
29 1
        $UserTable->setPrimaryKey(['uuid']);
30 1
        $UserTable->addColumn('username', 'string', ['length' => 180]);
31 1
        $UserTable->addColumn('username_canonical', 'string', ['length' => 180]);
32 1
        $UserTable->addUniqueIndex(['username_canonical'], 'username_canonical_unique_index'); // name probably not needed
33 1
        $UserTable->addColumn('email', 'string', ['length' => 180]);
34 1
        $UserTable->addColumn('email_canonical', 'string', ['length' => 180]);
35 1
        $UserTable->addUniqueIndex(['email_canonical'], 'email_canonical_unique_index'); // name probably not needed
36 1
        $UserTable->addColumn('enabled', 'boolean');
37 1
        $UserTable->addColumn('salt', 'string', ['notnull' => false]); // 'length' => 255
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
38 1
        $UserTable->addColumn('password', 'string'); // 'length' => 255
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
39 1
        $UserTable->addColumn('last_login', 'datetime', ['notnull' => false]);
40 1
        $UserTable->addColumn('confirmation_token', 'string', ['length' => 180, 'notnull' => false]);
41 1
        $UserTable->addUniqueIndex(['confirmation_token'], 'confirmation_token_unique_index'); // name probably not needed
42 1
        $UserTable->addColumn('password_requested_at', 'datetime', ['notnull' => false]);
43 1
        $UserTable->addColumn('roles', 'array');
44
45 1
        return $UserTable;
46
    }
47
}
48
49
// https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/config/doctrine-mapping/User.orm.xml
50