GeolocationTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A validGeolocation() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Assert;
6
7
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
8
9
/**
10
 * @package simplesamlphp/saml2
11
 */
12
trait GeolocationTrait
13
{
14
    // @TODO: this regex is incomplete, so reverting to the default URI-check
15
    //private static string $geolocation_regex = '/^geo:([-+]?\d+(?:\.\d+)?),([-+]?\d+(?:\.\d+)?)(?:\?z=(\d{1,2}))?$/';
16
17
    /**
18
     */
19
    protected static function validGeolocation(string $value, string $message = ''): void
0 ignored issues
show
Unused Code introduced by
The parameter $message 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

19
    protected static function validGeolocation(string $value, /** @scrutinizer ignore-unused */ string $message = ''): void

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...
20
    {
21
        // Assert::regex(
22
        //     $value,
23
        //     '/^geo:([-+]?\d+(?:\.\d+)?),([-+]?\d+(?:\.\d+)?)(?:\?z=(\d{1,2}))?$/',
24
        //     'Content is not a valid geolocation:  %s'
25
        // );
26
        // The regex above is incomplete, so for now we only test for a valid URI
27
28
        static::validAnyURI($value, ProtocolViolationException::class);
29
    }
30
}
31