MySqlGrammar::compileSpatial()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace LaravelSpatial\Schema\Grammars;
4
5
use Illuminate\Support\Fluent;
6
use Illuminate\Database\Schema\Blueprint;
7
8
/**
9
 * Class MySqlGrammar
10
 *
11
 * @package LaravelSpatial\Schema\Grammars
12
 */
13
class MySqlGrammar extends \Illuminate\Database\Schema\Grammars\MySqlGrammar
14
{
15
    /**
16
     * Compile a spatial index key command.
17
     *
18
     * @param  \Illuminate\Database\Schema\Blueprint $blueprint
19
     * @param  \Illuminate\Support\Fluent $command
20
     *
21
     * @return string
22
     */
23
    public function compileSpatial(Blueprint $blueprint, Fluent $command)
24
    {
25
        return $this->compileKey($blueprint, $command, 'spatial');
26
    }
27
28
    /**
29
     * Compile a drop index command.
30
     *
31
     * @param  \Illuminate\Database\Schema\Blueprint $blueprint
32
     * @param  \Illuminate\Support\Fluent $command
33
     *
34
     * @return string
35
     */
36
    public function compileDropSpatial(Blueprint $blueprint, Fluent $command)
37
    {
38
        $table = $this->wrapTable($blueprint);
39
40
        $index = $this->wrap($command->index);
41
42
        return "alter table {$table} drop index {$index}";
43
    }
44
}
45