PostGISSchemaManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 12
ccs 0
cts 4
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A schemaUpdate() 0 8 3
1
<?php
2
3
namespace Smindel\GIS\ORM;
4
5
use SilverStripe\PostgreSQL\PostgreSQLSchemaManager;
0 ignored issues
show
Bug introduced by
The type SilverStripe\PostgreSQL\PostgreSQLSchemaManager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use SilverStripe\ORM\DB;
7
use SilverStripe\ORM\FieldType\DBField;
8
use SilverStripe\Control\Director;
9
use SilverStripe\Core\Config\Config;
10
use Smindel\GIS\GIS;
11
use Smindel\GIS\ORM\FieldType\DBGeometry;
12
use Exception;
13
14
/*
15
http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions
16
*/
17
18
if (!class_exists(PostgreSQLSchemaManager::class)) {
19
    return;
20
}
21
22
class PostGISSchemaManager extends PostgreSQLSchemaManager
23
{
24
    use GISSchemaManager;
25
26
    public function schemaUpdate($callback)
27
    {
28
        // @todo: terrible hack to make the postgis extension manually installed in the "public" schema
29
        // abailable in the unit test db
30
        if (Director::is_cli() && !Director::isLive()) {
31
            DB::get_conn()->setSchemaSearchPath(DB::get_conn()->currentSchema(), 'public');
0 ignored issues
show
Bug introduced by
The method currentSchema() does not exist on SilverStripe\ORM\Connect\Database. ( Ignorable by Annotation )

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

31
            DB::get_conn()->setSchemaSearchPath(DB::get_conn()->/** @scrutinizer ignore-call */ currentSchema(), 'public');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method setSchemaSearchPath() does not exist on SilverStripe\ORM\Connect\Database. ( Ignorable by Annotation )

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

31
            DB::get_conn()->/** @scrutinizer ignore-call */ setSchemaSearchPath(DB::get_conn()->currentSchema(), 'public');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        }
33
        parent::schemaUpdate($callback);
34
    }
35
}
36