LongitudeEvaluator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluateFieldValue() 0 11 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\Evaluation;
13
14
use TYPO3\CMS\Core\Utility\MathUtility;
15
16
class LongitudeEvaluator
17
{
18
    /**
19
     * Validates the given longitude value (between -180 and 180 degrees)
20
     * @see https://developers.google.com/maps/documentation/javascript/reference?hl=fr#LatLng
21
     */
22
    public function evaluateFieldValue(string $value, string $is_in, bool &$set): string
0 ignored issues
show
Unused Code introduced by
The parameter $is_in 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

22
    public function evaluateFieldValue(string $value, /** @scrutinizer ignore-unused */ string $is_in, bool &$set): string

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...
23
    {
24
        $newValue = '0.000000';
25
        $set = true;
26
        if (MathUtility::canBeInterpretedAsFloat($value) &&
27
            ((float)$value >= -180 && (float)$value <= 180)
28
        ) {
29
            $newValue = number_format((float)$value, 6);
30
        }
31
32
        return $newValue;
33
    }
34
}
35