@@ 30-101 (lines=72) @@ | ||
27 | * @package Elastification\Client\Request\Shared\Index |
|
28 | * @author Daniel Wendlandt |
|
29 | */ |
|
30 | abstract class AbstractDeleteTemplateRequest extends AbstractBaseRequest |
|
31 | { |
|
32 | ||
33 | const REQUEST_ACTION = '_template'; |
|
34 | ||
35 | /** |
|
36 | * @param string $templateName |
|
37 | * @param SerializerInterface $serializer |
|
38 | * @param array $serializerParams |
|
39 | */ |
|
40 | public function __construct($templateName, SerializerInterface $serializer, array $serializerParams = array()) |
|
41 | { |
|
42 | $this->serializer = $serializer; |
|
43 | $this->serializerParams = $serializerParams; |
|
44 | ||
45 | if (!empty($templateName)) { |
|
46 | $this->type = $templateName; |
|
47 | } |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @inheritdoc |
|
52 | */ |
|
53 | public function getMethod() |
|
54 | { |
|
55 | return RequestMethods::DELETE; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * @inheritdoc |
|
60 | */ |
|
61 | public function getIndex() |
|
62 | { |
|
63 | return self::REQUEST_ACTION; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @inheritdoc |
|
68 | */ |
|
69 | public function getAction() |
|
70 | { |
|
71 | return null; |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * @inheritdoc |
|
76 | */ |
|
77 | public function getBody() |
|
78 | { |
|
79 | return null; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @inheritdoc |
|
84 | */ |
|
85 | public function setBody($body) |
|
86 | { |
|
87 | //do nothing |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * Sets the template name |
|
92 | * |
|
93 | * @param $name |
|
94 | * |
|
95 | * @author Daniel Wendlandt |
|
96 | */ |
|
97 | public function setTemplateName($name) |
|
98 | { |
|
99 | $this->type = $name; |
|
100 | } |
|
101 | } |
|
102 |
@@ 30-101 (lines=72) @@ | ||
27 | * @package Elastification\Client\Request\Shared\Index |
|
28 | * @author Daniel Wendlandt |
|
29 | */ |
|
30 | abstract class AbstractGetTemplateRequest extends AbstractBaseRequest |
|
31 | { |
|
32 | ||
33 | const REQUEST_ACTION = '_template'; |
|
34 | ||
35 | /** |
|
36 | * @param string $templateName |
|
37 | * @param SerializerInterface $serializer |
|
38 | * @param array $serializerParams |
|
39 | */ |
|
40 | public function __construct($templateName, SerializerInterface $serializer, array $serializerParams = array()) |
|
41 | { |
|
42 | $this->serializer = $serializer; |
|
43 | $this->serializerParams = $serializerParams; |
|
44 | ||
45 | if (!empty($templateName)) { |
|
46 | $this->type = $templateName; |
|
47 | } |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @inheritdoc |
|
52 | */ |
|
53 | public function getMethod() |
|
54 | { |
|
55 | return RequestMethods::GET; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * @inheritdoc |
|
60 | */ |
|
61 | public function getIndex() |
|
62 | { |
|
63 | return self::REQUEST_ACTION; |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * @inheritdoc |
|
68 | */ |
|
69 | public function getAction() |
|
70 | { |
|
71 | return null; |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * @inheritdoc |
|
76 | */ |
|
77 | public function getBody() |
|
78 | { |
|
79 | return null; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @inheritdoc |
|
84 | */ |
|
85 | public function setBody($body) |
|
86 | { |
|
87 | //do nothing |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * Sets the template name |
|
92 | * |
|
93 | * @param $name |
|
94 | * |
|
95 | * @author Daniel Wendlandt |
|
96 | */ |
|
97 | public function setTemplateName($name) |
|
98 | { |
|
99 | $this->type = $name; |
|
100 | } |
|
101 | } |
|
102 |