ProviderRecord   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 2
dl 0
loc 75
c 0
b 0
f 0
ccs 28
cts 28
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoginRequestPath() 0 13 2
A getLogoutRequestPath() 0 13 2
A getLoginPath() 0 13 2
A getLogoutPath() 0 13 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: dsmrt
5
 * Date: 1/12/18
6
 * Time: 9:33 PM
7
 */
8
9
namespace flipbox\saml\sp\records;
10
11
use flipbox\saml\core\records\AbstractProvider;
12
use flipbox\saml\core\records\ProviderInterface;
13
use flipbox\saml\sp\models\Settings;
14
use flipbox\saml\sp\Saml;
15
16
class ProviderRecord extends AbstractProvider implements ProviderInterface
17
{
18
19
    /**
20
     * The table alias
21
     */
22
    const TABLE_ALIAS = 'saml_sp_providers';
23
24
    /**
25
     * @inheritdoc
26
     */
27 6
    public function getLoginRequestPath()
28
    {
29 6
        if ($this->providerType !== Settings::IDP) {
0 ignored issues
show
Documentation introduced by
The property providerType does not exist on object<flipbox\saml\sp\records\ProviderRecord>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
30 3
            return null;
31
        }
32 3
        return implode(
33 3
            DIRECTORY_SEPARATOR,
34
            [
35 3
                Saml::getInstance()->getSettings()->getDefaultLoginRequestPath(),
36 3
                $this->uid,
37
            ]
38
        );
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44 6
    public function getLogoutRequestPath()
45
    {
46 6
        if ($this->providerType !== Settings::IDP) {
0 ignored issues
show
Documentation introduced by
The property providerType does not exist on object<flipbox\saml\sp\records\ProviderRecord>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
47 3
            return null;
48
        }
49 3
        return implode(
50 3
            DIRECTORY_SEPARATOR,
51
            [
52 3
                Saml::getInstance()->getSettings()->getDefaultLogoutRequestPath(),
53 3
                $this->uid,
54
            ]
55
        );
56
    }
57
    /**
58
     * @inheritdoc
59
     */
60 21
    public function getLoginPath()
61
    {
62 21
        if ($this->providerType !== Settings::IDP) {
0 ignored issues
show
Documentation introduced by
The property providerType does not exist on object<flipbox\saml\sp\records\ProviderRecord>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
63 18
            return null;
64
        }
65 3
        return implode(
66 3
            DIRECTORY_SEPARATOR,
67
            [
68 3
                Saml::getInstance()->getSettings()->getDefaultLoginEndpoint(),
69 3
                $this->uid,
70
            ]
71
        );
72
    }
73
74
    /**
75
     * @inheritdoc
76
     */
77 6
    public function getLogoutPath()
78
    {
79 6
        if ($this->providerType !== Settings::IDP) {
0 ignored issues
show
Documentation introduced by
The property providerType does not exist on object<flipbox\saml\sp\records\ProviderRecord>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
80 3
            return null;
81
        }
82 3
        return implode(
83 3
            DIRECTORY_SEPARATOR,
84
            [
85 3
                Saml::getInstance()->getSettings()->getDefaultLogoutEndpoint(),
86 3
                $this->uid,
87
            ]
88
        );
89
    }
90
}
91