SelectType   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 1
eloc 13
c 2
b 1
f 1
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 1
1
<?php
2
3
namespace Socialblue\LaravelQueryAdviser\Enum;
4
5
final class SelectType
6
{
7
    public const SIMPLE = 'simple SELECT query without any subqueries or UNIONs';
8
9
    public const PRIMARY = 'SELECT is in the outermost query in a JOIN';
10
11
    public const SUBQUERY = 'SELECT is part of a subquery within a FROM clause';
12
13
    public const DEPENDENT_SUBQUERY = 'a subquery which is dependent upon on outer query';
14
15
    public const UNCACHEABLE_SUBQUERY = 'a subquery which is not cacheable (there are certain conditions for a query to be cacheable)';
16
17
    public const UNION = 'the SELECT is the second or later statement of a UNION';
18
19
    public const DEPENDENT_UNION = 'the second or later SELECT of a UNION is dependent on an outer query';
20
21
    public const UNION_RESULT = 'SELECT is a result of a UNION';
22
23
    public const DERIVED = 'DERIVED';
24
25
    public static function get($type): string
26
    {
27
        $type = strtoupper($type);
28
        $type = str_replace(" ", "_", $type);
29
30
        return (string) constant("self::$type");
31
    }
32
}
33