Passed
Pull Request — master (#37)
by Tim
02:29
created

Url   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkServiceURL() 0 6 1
A sanitize() 0 3 1
1
<?php
2
3
/*
4
 *    simpleSAMLphp-casserver is a CAS 1.0 and 2.0 compliant CAS server in the form of a simpleSAMLphp module
5
 *
6
 *    Copyright (C) 2013  Bjorn R. Jensen
7
 *
8
 *    This library is free software; you can redistribute it and/or
9
 *    modify it under the terms of the GNU Lesser General Public
10
 *    License as published by the Free Software Foundation; either
11
 *    version 2.1 of the License, or (at your option) any later version.
12
 *
13
 *    This library is distributed in the hope that it will be useful,
14
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 *    Lesser General Public License for more details.
17
 *
18
 *    You should have received a copy of the GNU Lesser General Public
19
 *    License along with this library; if not, write to the Free Software
20
 *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
 *
22
 */
23
24
declare(strict_types=1);
25
26
namespace SimpleSAML\Module\casserver\Utils;
27
28
use SimpleSAML\Configuration;
29
use SimpleSAML\Module\casserver\Cas\ServiceValidator;
30
use SimpleSAML\Module\casserver\Cas\TicketValidator;
31
32
class Url
33
{
34
    /**
35
     * @deprecated
36
     * @see ServiceValidator
37
     * @param string $service
38
     * @param array $legal_service_urls
39
     * @return bool
40
     */
41
    function checkServiceURL(string $service, array $legal_service_urls): bool
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
42
    {
43
        //delegate to ServiceValidator until all references to this can be cleaned up
44
        $config = Configuration::loadFromArray(['legal_service_urls' => $legal_service_urls]);
45
        $serviceValidator = new ServiceValidator($config);
46
        return $serviceValidator->checkServiceURL($service) !== null;
47
    }
48
49
50
    /**
51
     * @param string $parameter
52
     * @return string
53
     */
54
    function sanitize(string $parameter): string
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
55
    {
56
        return TicketValidator::sanitize($parameter);
57
    }
58
}
59