Code Duplication    Length = 70-70 lines in 2 locations

src/Request/Shared/Index/AbstractDeleteWarmerRequest.php 1 location

@@ 31-100 (lines=70) @@
28
 * @package Elastification\Client\Request\Shared\Index
29
 * @author  Daniel Wendlandt
30
 */
31
abstract class AbstractDeleteWarmerRequest extends AbstractBaseRequest
32
{
33
34
    const REQUEST_ACTION = '_warmer';
35
36
    /**
37
     * @var null|string
38
     */
39
    private $warmerName = null;
40
41
    /**
42
     * @inheritdoc
43
     */
44
    public function getMethod()
45
    {
46
        return RequestMethods::DELETE;
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function getAction()
53
    {
54
        if (empty($this->warmerName)) {
55
            throw new RequestException('Warmer name is not set');
56
        }
57
58
        return self::REQUEST_ACTION . '/' . $this->warmerName;
59
    }
60
61
    /**
62
     * Gets the name of the warmer
63
     *
64
     * @return null|string
65
     * @author Daniel Wendlandt
66
     */
67
    public function getWarmerName()
68
    {
69
        return $this->warmerName;
70
    }
71
72
    /**
73
     * sets the name of the warmer
74
     *
75
     * @param string $warmerName
76
     *
77
     * @author Daniel Wendlandt
78
     */
79
    public function setWarmerName($warmerName)
80
    {
81
        $this->warmerName = $warmerName;
82
    }
83
84
    /**
85
     * @inheritdoc
86
     */
87
    public function getBody()
88
    {
89
        return null;
90
    }
91
92
    /**
93
     * @inheritdoc
94
     */
95
    public function setBody($body)
96
    {
97
        //do nothing
98
    }
99
100
}
101

src/Request/Shared/Index/AbstractGetWarmerRequest.php 1 location

@@ 31-100 (lines=70) @@
28
 * @package Elastification\Client\Request\Shared\Index
29
 * @author  Daniel Wendlandt
30
 */
31
abstract class AbstractGetWarmerRequest extends AbstractBaseRequest
32
{
33
34
    const REQUEST_ACTION = '_warmer';
35
36
    /**
37
     * @var null|string
38
     */
39
    private $warmerName = null;
40
41
    /**
42
     * @inheritdoc
43
     */
44
    public function getMethod()
45
    {
46
        return RequestMethods::GET;
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function getAction()
53
    {
54
        if (empty($this->warmerName)) {
55
            throw new RequestException('Warmer name is not set');
56
        }
57
58
        return self::REQUEST_ACTION . '/' . $this->warmerName;
59
    }
60
61
    /**
62
     * Gets the name of the warmer
63
     *
64
     * @return null|string
65
     * @author Daniel Wendlandt
66
     */
67
    public function getWarmerName()
68
    {
69
        return $this->warmerName;
70
    }
71
72
    /**
73
     * sets the name of the warmer
74
     *
75
     * @param string $warmerName
76
     *
77
     * @author Daniel Wendlandt
78
     */
79
    public function setWarmerName($warmerName)
80
    {
81
        $this->warmerName = $warmerName;
82
    }
83
84
    /**
85
     * @inheritdoc
86
     */
87
    public function getBody()
88
    {
89
        return null;
90
    }
91
92
    /**
93
     * @inheritdoc
94
     */
95
    public function setBody($body)
96
    {
97
        //do nothing
98
    }
99
100
}
101