Mysql::getTypes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
ccs 0
cts 9
cp 0
crap 2
rs 10
1
<?php
2
3
namespace CodexShaper\DBM\Database\Platforms;
4
5
use CodexShaper\DBM\Database\Types\Type;
6
use Illuminate\Support\Collection;
7
8
abstract class Mysql extends Platform
9
{
10
    /**
11
     * Get Types.
12
     *
13
     * @return \Illuminate\Support\Collection
14
     */
15
    public static function getTypes(Collection $typeMapping)
16
    {
17
        $typeMapping->forget([
18
            'real', // same as double
19
            'int', // same as integer
20
            'string', // same as varchar
21
            'numeric', // same as decimal
22
        ]);
23
24
        return $typeMapping;
25
    }
26
27
    /**
28
     * Register Custom Type Options.
29
     *
30
     * @return void
31
     */
32
    public static function registerCustomTypeOptions()
33
    {
34
        // Not supported
35
        Type::registerCustomOption(Type::NOT_SUPPORTED, true, [
0 ignored issues
show
Bug introduced by
The constant CodexShaper\DBM\Database\Types\Type::NOT_SUPPORTED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The method registerCustomOption() does not exist on CodexShaper\DBM\Database\Types\Type. Did you maybe mean registerCustomTypes()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        Type::/** @scrutinizer ignore-call */ 
36
              registerCustomOption(Type::NOT_SUPPORTED, true, [

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
            'enum',
37
            'set',
38
        ]);
39
40
        // Not support index
41
        Type::registerCustomOption(Type::NOT_SUPPORT_INDEX, true, '*text');
0 ignored issues
show
Bug introduced by
The constant CodexShaper\DBM\Database...Type::NOT_SUPPORT_INDEX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42
        Type::registerCustomOption(Type::NOT_SUPPORT_INDEX, true, '*blob');
43
44
        // Disable Default for unsupported types
45
        Type::registerCustomOption('default', [
46
            'disabled' => true,
47
        ], '*text');
48
        Type::registerCustomOption('default', [
49
            'disabled' => true,
50
        ], '*blob');
51
        Type::registerCustomOption('default', [
52
            'disabled' => true,
53
        ], 'json');
54
    }
55
}
56