| 1 | <?php |
||
| 8 | class Action implements ActionInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Action name. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $name; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Action title. |
||
| 19 | * |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $title; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Fields displayed for this action. |
||
| 26 | * |
||
| 27 | * @var Field[] |
||
| 28 | */ |
||
| 29 | protected $fields = []; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Action permissions. |
||
| 33 | * |
||
| 34 | * @var string[] |
||
| 35 | */ |
||
| 36 | protected $permissions = []; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var ActionConfiguration |
||
| 40 | */ |
||
| 41 | protected $configuration; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var array |
||
| 45 | */ |
||
| 46 | protected $filters = []; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Action constructor. |
||
| 50 | * |
||
| 51 | * @param $actionName |
||
| 52 | * @param ActionConfiguration $configuration |
||
| 53 | */ |
||
| 54 | 7 | public function __construct($actionName, ActionConfiguration $configuration) |
|
| 55 | { |
||
| 56 | 7 | $this->configuration = $configuration; |
|
| 57 | 7 | $this->name = $actionName; |
|
| 58 | 7 | $this->title = $configuration->getParameter('title'); |
|
| 59 | 7 | $this->permissions = $configuration->getParameter('permissions'); |
|
|
1 ignored issue
–
show
|
|||
| 60 | 7 | } |
|
| 61 | |||
| 62 | /** |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | 7 | public function getName() |
|
| 66 | { |
||
| 67 | 7 | return $this->name; |
|
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | 1 | public function getTitle() |
|
| 77 | |||
| 78 | /** |
||
| 79 | * @return Field[] |
||
| 80 | */ |
||
| 81 | 1 | public function getFields() |
|
| 85 | |||
| 86 | /** |
||
| 87 | * Return true if action has a field named $fieldName. |
||
| 88 | * |
||
| 89 | * @param string $fieldName |
||
| 90 | * |
||
| 91 | * @return bool |
||
| 92 | */ |
||
| 93 | public function hasField($fieldName) |
||
| 94 | { |
||
| 95 | return array_key_exists($fieldName, $this->fields); |
||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @param Field[] $fields |
||
| 100 | */ |
||
| 101 | public function setFields($fields) |
||
| 102 | { |
||
| 103 | $this->fields = $fields; |
||
| 104 | } |
||
| 105 | |||
| 106 | /** |
||
| 107 | * @param Field $field |
||
| 108 | */ |
||
| 109 | 1 | public function addField(Field $field) |
|
| 110 | { |
||
| 111 | 1 | $this->fields[$field->getName()] = $field; |
|
| 112 | 1 | } |
|
| 113 | |||
| 114 | /** |
||
| 115 | * @return string[] |
||
| 116 | */ |
||
| 117 | 2 | public function getPermissions() |
|
| 118 | { |
||
| 119 | 2 | return $this->permissions; |
|
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
| 123 | * @return array |
||
| 124 | */ |
||
| 125 | public function getFilters() |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @param array $filters |
||
| 132 | */ |
||
| 133 | public function setFilters($filters) |
||
| 134 | { |
||
| 135 | $this->filters = $filters; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @param Filter $filter |
||
| 140 | */ |
||
| 141 | public function addFilter(Filter $filter) |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @return ActionConfiguration |
||
| 148 | */ |
||
| 149 | 6 | public function getConfiguration() |
|
| 153 | } |
||
| 154 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..