Completed
Push — master ( 06c91e...9b25cd )
by Jean-Bernard
01:57
created

SchemaBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
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
        // $UserTable->addColumn('deleted', 'datetime', ['notnull' => false]);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
31
        //^ Users should not be able to delete this, probably.
32 1
        $UserTable->addColumn('username', 'string', ['length' => 180]);
33 1
        $UserTable->addColumn('username_canonical', 'string', ['length' => 180]);
34 1
        $UserTable->addUniqueIndex(['username_canonical'], 'username_canonical_unique_index'); // name probably not needed
35 1
        $UserTable->addColumn('email', 'string', ['length' => 180]);
36 1
        $UserTable->addColumn('email_canonical', 'string', ['length' => 180]);
37 1
        $UserTable->addUniqueIndex(['email_canonical'], 'email_canonical_unique_index'); // name probably not needed
38 1
        $UserTable->addColumn('enabled', 'boolean');
39 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...
40 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...
41 1
        $UserTable->addColumn('last_login', 'datetime', ['notnull' => false]);
42 1
        $UserTable->addColumn('confirmation_token', 'string', ['length' => 180, 'notnull' => false]);
43 1
        $UserTable->addUniqueIndex(['confirmation_token'], 'confirmation_token_unique_index'); // name probably not needed
44 1
        $UserTable->addColumn('password_requested_at', 'datetime', ['notnull' => false]);
45 1
        $UserTable->addColumn('roles', 'array');
46
47 1
        return $UserTable;
48
    }
49
}
50
51
// https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/config/doctrine-mapping/User.orm.xml
52