Add the request type to the action
This commit is contained in:
parent
f0ecfa6e6c
commit
3bdfef9107
|
@ -34,6 +34,9 @@ class Action implements IAction {
|
|||
/** @var string */
|
||||
protected $link;
|
||||
|
||||
/** @var string */
|
||||
protected $requestType;
|
||||
|
||||
/** @var string */
|
||||
protected $icon;
|
||||
|
||||
|
@ -44,6 +47,7 @@ class Action implements IAction {
|
|||
$this->label = '';
|
||||
$this->labelParsed = '';
|
||||
$this->link = '';
|
||||
$this->requestType = '';
|
||||
$this->icon = '';
|
||||
}
|
||||
|
||||
|
@ -93,14 +97,18 @@ class Action implements IAction {
|
|||
|
||||
/**
|
||||
* @param string $link
|
||||
* @param string $requestType
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException if the link is invalid
|
||||
* @since 8.2.0
|
||||
*/
|
||||
public function setLink($link) {
|
||||
public function setLink($link, $requestType) {
|
||||
if (!is_string($link) || $link === '' || isset($link[256])) {
|
||||
throw new \InvalidArgumentException('The given link is invalid');
|
||||
}
|
||||
if (!in_array($requestType, ['GET', 'POST', 'PUT', 'DELETE'])) {
|
||||
throw new \InvalidArgumentException('The given request type is invalid');
|
||||
}
|
||||
$this->link = $link;
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -62,11 +62,12 @@ interface IAction {
|
|||
|
||||
/**
|
||||
* @param string $link
|
||||
* @param string $requestType
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException if the link is invalid
|
||||
* @since 8.2.0
|
||||
*/
|
||||
public function setLink($link);
|
||||
public function setLink($link, $requestType);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
|
|
Loading…
Reference in New Issue