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

SqlServerGrammar::compileFirstPathSegment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 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