Skip to content

Commit 93dcd50

Browse files
committed
Fixed Code Style
1 parent 9898d5c commit 93dcd50

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

app/code/Magento/Backend/Model/Menu/Item/Validator.php

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
*/
66
namespace Magento\Backend\Model\Menu\Item;
77

8+
use BadMethodCallException;
9+
use InvalidArgumentException;
10+
use Zend_Validate;
11+
812
/**
13+
* Class Validator
14+
*
15+
* @package Magento\Backend\Model\Menu\Item
916
* @api
1017
* @since 100.0.2
1118
*/
@@ -28,7 +35,7 @@ class Validator
2835
/**
2936
* The list of primitive validators
3037
*
31-
* @var \Zend_Validate[]
38+
* @var Zend_Validate[]
3239
*/
3340
protected $_validators = [];
3441

@@ -37,17 +44,17 @@ class Validator
3744
*/
3845
public function __construct()
3946
{
40-
$idValidator = new \Zend_Validate();
47+
$idValidator = new Zend_Validate();
4148
$idValidator->addValidator(new \Zend_Validate_StringLength(['min' => 3]));
4249
$idValidator->addValidator(new \Zend_Validate_Regex('/^[A-Za-z0-9\/:_]+$/'));
4350

44-
$resourceValidator = new \Zend_Validate();
51+
$resourceValidator = new Zend_Validate();
4552
$resourceValidator->addValidator(new \Zend_Validate_StringLength(['min' => 8]));
4653
$resourceValidator->addValidator(
4754
new \Zend_Validate_Regex('/^[A-Z][A-Za-z0-9]+_[A-Z][A-Za-z0-9]+::[A-Za-z_0-9]+$/')
4855
);
4956

50-
$attributeValidator = new \Zend_Validate();
57+
$attributeValidator = new Zend_Validate();
5158
$attributeValidator->addValidator(new \Zend_Validate_StringLength(['min' => 3]));
5259
$attributeValidator->addValidator(new \Zend_Validate_Regex('/^[A-Za-z0-9\/_\-]+$/'));
5360

@@ -70,8 +77,8 @@ public function __construct()
7077
*
7178
* @param array $data
7279
* @return void
73-
* @throws \InvalidArgumentException
74-
* @throws \BadMethodCallException
80+
* @throws InvalidArgumentException
81+
* @throws BadMethodCallException
7582
*/
7683
public function validate($data)
7784
{
@@ -101,15 +108,16 @@ private function checkMenuItemIsRemoved($data)
101108

102109
/**
103110
* Check that menu item contains all required data
111+
*
104112
* @param array $data
105113
*
106-
* @throws \BadMethodCallException
114+
* @throws BadMethodCallException
107115
*/
108116
private function assertContainsRequiredParameters($data)
109117
{
110118
foreach ($this->_required as $param) {
111119
if (!isset($data[$param])) {
112-
throw new \BadMethodCallException('Missing required param ' . $param);
120+
throw new BadMethodCallException('Missing required param ' . $param);
113121
}
114122
}
115123
}
@@ -118,12 +126,12 @@ private function assertContainsRequiredParameters($data)
118126
* Check that menu item id is not used
119127
*
120128
* @param string $id
121-
* @throws \InvalidArgumentException
129+
* @throws InvalidArgumentException
122130
*/
123131
private function assertIdentifierIsNotUsed($id)
124132
{
125133
if (array_search($id, $this->_ids) !== false) {
126-
throw new \InvalidArgumentException('Item with id ' . $id . ' already exists');
134+
throw new InvalidArgumentException('Item with id ' . $id . ' already exists');
127135
}
128136
}
129137

@@ -132,7 +140,7 @@ private function assertIdentifierIsNotUsed($id)
132140
*
133141
* @param string $param
134142
* @param mixed $value
135-
* @throws \InvalidArgumentException
143+
* @throws InvalidArgumentException
136144
*/
137145
private function validateMenuItemParameter($param, $value)
138146
{
@@ -148,7 +156,7 @@ private function validateMenuItemParameter($param, $value)
148156
return;
149157
}
150158

151-
throw new \InvalidArgumentException(
159+
throw new InvalidArgumentException(
152160
"Param " . $param . " doesn't pass validation: " . implode(
153161
'; ',
154162
$validator->getMessages()
@@ -162,16 +170,16 @@ private function validateMenuItemParameter($param, $value)
162170
* @param string $param
163171
* @param mixed $value
164172
* @return void
165-
* @throws \InvalidArgumentException
173+
* @throws InvalidArgumentException
166174
*/
167175
public function validateParam($param, $value)
168176
{
169177
if (in_array($param, $this->_required) && $value === null) {
170-
throw new \InvalidArgumentException('Param ' . $param . ' is required');
178+
throw new InvalidArgumentException('Param ' . $param . ' is required');
171179
}
172180

173181
if ($value !== null && isset($this->_validators[$param]) && !$this->_validators[$param]->isValid($value)) {
174-
throw new \InvalidArgumentException(
182+
throw new InvalidArgumentException(
175183
'Param ' . $param . ' doesn\'t pass validation: ' . implode(
176184
'; ',
177185
$this->_validators[$param]->getMessages()

0 commit comments

Comments
 (0)