Code Duplication    Length = 25-26 lines in 2 locations

lib/DependencyInjection/Request.php 1 location

@@ 5-29 (lines=25) @@
2
3
namespace \SimpleSAML\Module\monitor\DependencyInjection;
4
5
class Request
6
{
7
    // The canonical list of acceptable request parameters
8
    /**
9
     * @var mixed
10
     */
11
    public $xml;
12
13
    /**
14
     * @param array $requestVars
15
     *
16
     * @return Request
17
     */
18
    public function __construct($requestVars)
19
    {
20
        $objectVars = get_object_vars($this);
21
        foreach ($requestVars as $property => $value)
22
        {
23
            if (array_key_exists($property, $objectVars)) {
24
                $this->$property = $value;
25
            }
26
        }
27
        return $this;
28
    }
29
}
30

lib/DependencyInjection/Server.php 1 location

@@ 5-30 (lines=26) @@
2
3
namespace \SimpleSAML\Module\monitor\DependencyInjection;
4
5
class Server
6
{
7
    // The canonical list of acceptable server parameters
8
    /**
9
     * @var mixed
10
     */
11
    public $SERVER_NAME, $SERVER_PORT, $HTTP_AUTHORIZATION, $SERVER_PROTOCOL;
12
13
    /**
14
     * @param array $serverVars
15
     *
16
     * @return Request
17
     */
18
19
    public function __construct($serverVars)
20
    {
21
        $objectVars = get_object_vars($this);
22
        foreach ($serverVars as $property => $value)
23
        {
24
            if (array_key_exists($property, $objectVars)) {
25
                $this->$property = $value;
26
            }
27
        }
28
        return $this;
29
    }
30
}
31