gdbots/common-php

View on GitHub
src/Common/GeoPoint.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '37', column '23').
Open

            throw new \InvalidArgumentException('Longitude must be within range [-180.0, 180.0]');
Severity: Minor
Found in src/Common/GeoPoint.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '65', column '19').
Open

        throw new \InvalidArgumentException('Payload must be a GeoJson "Point" type.');
Severity: Minor
Found in src/Common/GeoPoint.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Remove error control operator '@' on line 27.
Open

    public function __construct($lat, $lon)
    {
        @trigger_error(sprintf('"%s" is deprecated.  Use "Gdbots\Pbj\WellKnown\GeoPoint" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED);

        $this->latitude = (float)$lat;
Severity: Minor
Found in src/Common/GeoPoint.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

Missing class import via use statement (line '33', column '23').
Open

            throw new \InvalidArgumentException('Latitude must be within range [-90.0, 90.0]');
Severity: Minor
Found in src/Common/GeoPoint.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Line exceeds 120 characters; contains 164 characters
Open

        @trigger_error(sprintf('"%s" is deprecated.  Use "Gdbots\Pbj\WellKnown\GeoPoint" from "gdbots/pbj" 1.1.x or later instead.', __CLASS__), E_USER_DEPRECATED);
Severity: Minor
Found in src/Common/GeoPoint.php by phpcodesniffer

There are no issues that match your filters.

Category
Status