MySQLGISSchemaManager::geography()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Smindel\GIS\ORM;
4
5
use SilverStripe\ORM\Connect\MySQLSchemaManager;
6
use SilverStripe\ORM\DB;
7
use Smindel\GIS\GIS;
8
9
class MySQLGISSchemaManager extends MySQLSchemaManager
10
{
11
    use GISSchemaManager;
0 ignored issues
show
introduced by
The trait Smindel\GIS\ORM\GISSchemaManager requires some properties which are not provided by Smindel\GIS\ORM\MySQLGISSchemaManager: $wkt, $srid
Loading history...
12
13
    public function geography($values)
0 ignored issues
show
Unused Code introduced by
The parameter $values is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

13
    public function geography(/** @scrutinizer ignore-unused */ $values)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
14
    {
15
        // ATTENTION: GEOGRAPHY IS NOT SUPPORTED BY MYSQL. THIS IS STRICTLY FOR COMPATIBILITY
16
        return 'geometry';
17
    }
18
19
    public function translateStGeometryTypeFilter($field, $value, $inclusive)
20
    {
21
        $null = $inclusive ? '' : ' OR ' . DB::get_conn()->nullCheckClause($field, true);
22
        $fragment = sprintf(
23
            '%sLOWER(ST_GeometryType(%s)) = ?%s',
24
            $inclusive ? '' : 'NOT ',
25
            $field,
26
            $null
27
        );
28
        return [$fragment => strtolower($value)];
29
    }
30
}
31