Completed
Push — develop ( 7427e0...b82f08 )
by Tom
14s
created
src/N98/Magento/Command/Eav/Attribute/Create/DummyCommand.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     protected function execute(InputInterface $input, OutputInterface $output)
193 193
     {
194 194
         $this->detectMagento($output, true);
195
-        if(!$this->initMagento()) {
195
+        if (!$this->initMagento()) {
196 196
             return;
197 197
         }
198 198
         $this->input = $input;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
         // MANAGE ARGUMENTS
204 204
         $_argument = $this->manageArguments($input, $output);
205
-        if(!in_array($input->getArgument('locale'), $this->_supported_locales)) {
205
+        if (!in_array($input->getArgument('locale'), $this->_supported_locales)) {
206 206
             $this->output->writeln("<warning>Locale `" . $input->getArgument('locale') . "` not supported, switch to default locale `us_US`.</warning>\r\n");
207 207
             $_argument['locale'] = "en_US";
208 208
         }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         for ($i = 0; $i < $_argument['values-number']; $i++) {
215 215
 
216 216
             $value = $this->createValue($_argument['values-type'], $_argument['locale']);
217
-            if(!$this->attributeValueExists($attribute, $value)) {
217
+            if (!$this->attributeValueExists($attribute, $value)) {
218 218
                 try {
219 219
                     $attribute->setData('option', array(
220 220
                         'value' => array(
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
         $_argument = array();
249 249
 
250 250
         // ATTRIBUTE ID
251
-        if(is_null($input->getArgument('attribute-id'))) {
251
+        if (is_null($input->getArgument('attribute-id'))) {
252 252
             $attribute_code = \Mage::getModel('eav/entity_attribute')->getCollection()
253 253
                 ->addFieldToSelect('*')
254 254
                 ->addFieldToFilter('entity_type_id', array('eq' => 4))
255 255
                 ->addFieldToFilter('backend_type', array('in' => array('int')))
256
-                ->setOrder('attribute_id', 'ASC');;
256
+                ->setOrder('attribute_id', 'ASC'); ;
257 257
             $_attribute_codes = array();
258 258
 
259 259
             foreach ($attribute_code as $item) {
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
             $input->setArgument('attribute-id', $response[0]);
270 270
         }
271 271
         $output->writeln('<info>Attribute code selected: ' . $input->getArgument('attribute-id') . "</info>\r\n");
272
-        $_argument['attribute-id'] = (int)$input->getArgument('attribute-id');
272
+        $_argument['attribute-id'] = (int) $input->getArgument('attribute-id');
273 273
 
274 274
         // TYPE OF VALUES
275
-        if(is_null($input->getArgument('values-type'))) {
275
+        if (is_null($input->getArgument('values-type'))) {
276 276
 
277 277
             $_values_type = array(
278 278
                 'int'      => 'int',
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
         $_argument['values-type'] = $input->getArgument('values-type');
295 295
 
296 296
         // NUMBER OF VALUES
297
-        if(is_null($input->getArgument('values-number'))) {
297
+        if (is_null($input->getArgument('values-number'))) {
298 298
             $question = new Question("Please enter the number of values to create (default 1): ", 1);
299 299
             $question->setValidator(function ($answer) {
300
-                $answer = (int)($answer);
301
-                if(!is_int($answer) || $answer <= 0) {
300
+                $answer = (int) ($answer);
301
+                if (!is_int($answer) || $answer <= 0) {
302 302
                     throw new \RuntimeException(
303 303
                         'Please enter an integer value or > 0'
304 304
                     );
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     protected function createValue($_type, $locale)
324 324
     {
325
-        if(!isset($this->faker)) {
325
+        if (!isset($this->faker)) {
326 326
             $this->faker = \Faker\Factory::create($locale);
327 327
         }
328 328
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         $options = $attribute_options_model->getAllOptions(false);
365 365
 
366 366
         foreach ($options as $option) {
367
-            if($option['label'] == $arg_value) {
367
+            if ($option['label'] == $arg_value) {
368 368
                 return true;
369 369
             }
370 370
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -205,8 +205,7 @@
 block discarded – undo
205 205
         if(!in_array($input->getArgument('locale'), $this->_supported_locales)) {
206 206
             $this->output->writeln("<warning>Locale `" . $input->getArgument('locale') . "` not supported, switch to default locale `us_US`.</warning>\r\n");
207 207
             $_argument['locale'] = "en_US";
208
-        }
209
-        else {
208
+        } else {
210 209
             $_argument['locale'] = $input->getArgument('locale');
211 210
         }
212 211
 
Please login to merge, or discard this patch.