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

SqlServerGrammar   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstPathSegmentBindings() 0 3 1
A compileFirstPathSegment() 0 5 1
1
<?php
2
3
namespace Staudenmeir\EloquentEagerLimitXLaravelAdjacencyList\Query\Grammars;
4
5
use Illuminate\Database\Query\Grammars\SqlServerGrammar as Base;
6
7
class SqlServerGrammar 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 "left($column, charindex(?, $column) - 1)";
20
	}
21
22
	// TODO
23
	public function getFirstPathSegmentBindings($pathSeparator)
24
	{
25
		return [$pathSeparator];
26
	}
27
}
28