Passed
Push — main ( 31aa9e...537bf7 )
by Jonas
11:44
created

SQLiteGrammar   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A compileFirstPathSegment() 0 5 1
1
<?php
2
3
namespace Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Query\Grammars;
4
5
use Illuminate\Database\Query\Grammars\SQLiteGrammar as Base;
6
7
class SQLiteGrammar extends Base implements EagerLimitGrammar
8
{
9
    /**
10
     * Compile an initial path. TODO
11
     *
12
     * @param string $column
13
     * @return string
14
     */
15
    public function compileFirstPathSegment($column)
16
    {
17
        $column = $this->wrap($column);
18
19
        return "(case when instr($column, ?) = 0 then $column else substr($column, 0, instr($column, ?)) end)";
20
    }
21
}
22