Code Duplication    Length = 18-18 lines in 5 locations

bundles/lib/Request/Cookies.php 1 location

@@ 10-27 (lines=18) @@
7
 */
8
namespace Venus\lib\Request;
9
10
class Cookies implements RequestInterface
11
{
12
    /**
13
     * get parameter
14
     * @param string $name
15
     * @param string $default
16
     * @return string
17
     */
18
    public function get(string $name, string $default = null) : string
19
    {
20
        if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') {
21
            return $_COOKIE[$name];
22
        } else if ($default !== null) {
23
            return $default;
24
        }
25
    }
26
}
27

bundles/lib/Request/Files.php 1 location

@@ 10-27 (lines=18) @@
7
 */
8
namespace Venus\lib\Request;
9
10
class Files implements RequestInterface
11
{
12
    /**
13
     * get parameter
14
     * @param string $name
15
     * @param string $default
16
     * @return string
17
     */
18
    public function get(string $name, string $default = null) : string
19
    {
20
        if (isset($_FILES[$name]) && $_FILES[$name] != '') {
21
            return $_FILES[$name];
22
        }
23
        else if ($default !== null) {
24
            return $default;
25
        }
26
    }
27
}
28

bundles/lib/Request/Query.php 1 location

@@ 10-27 (lines=18) @@
7
 */
8
namespace Venus\lib\Request;
9
10
class Query implements RequestInterface
11
{
12
    /**
13
     * get parameter
14
     * @param string $name
15
     * @param string $default
16
     * @return string
17
     */
18
    public function get(string $name, string $default = null) : string
19
    {
20
        if (isset($_GET[$name]) && $_GET[$name] != '') {
21
            return $_GET[$name];
22
        } else if ($default !== null) {
23
            return $default;
24
        }
25
    }
26
}
27

bundles/lib/Request/Request.php 1 location

@@ 10-27 (lines=18) @@
7
 */
8
namespace Venus\lib\Request;
9
10
class Request implements RequestInterface
11
{
12
    /**
13
     * get parameter
14
     * @param string $name
15
     * @param string $default
16
     * @return string
17
     */
18
    public function get(string $name, string $default = null) : string
19
    {
20
        if (isset($_POST[$name]) && $_POST[$name] != '') {
21
            return $_POST[$name];
22
        } else if ($default !== null) {
23
            return $default;
24
        }
25
    }
26
}
27

bundles/lib/Request/Server.php 1 location

@@ 10-27 (lines=18) @@
7
 */
8
namespace Venus\lib\Request;
9
10
class Server implements RequestInterface
11
{
12
    /**
13
     * get parameter
14
     * @param string $name
15
     * @param string $default
16
     * @return string
17
     */
18
    public function get(string $name, string $default = null) : string
19
    {
20
        if (isset($_SERVER[$name]) && $_SERVER[$name] != '') {
21
            return $_SERVER[$name];
22
        } else if ($default !== null) {
23
            return $default;
24
        }
25
    }
26
}
27