Completed
Push — develop ( 16b53b...b1079f )
by Tom
05:14
created
src/N98/Magento/Command/Category/Create/DummyCommand.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
     protected function configure()
21 21
     {
22 22
         $this->setName('category:create:dummy')
23
-             ->addArgument('store-id', InputArgument::OPTIONAL, 'Id of Store to create categories (default: 1)')
24
-             ->addArgument('category-number', InputArgument::OPTIONAL, 'Number of categories to create (default: 1)')
25
-             ->addArgument('children-categories-number', InputArgument::OPTIONAL, "Number of children for each category created (default: 0 - use '-1' for random from 0 to 5)")
26
-             ->addArgument('category-name-prefix', InputArgument::OPTIONAL, "Category Name Prefix (default: 'My Awesome Category')")
27
-             ->setDescription('Create a dummy category');
23
+                ->addArgument('store-id', InputArgument::OPTIONAL, 'Id of Store to create categories (default: 1)')
24
+                ->addArgument('category-number', InputArgument::OPTIONAL, 'Number of categories to create (default: 1)')
25
+                ->addArgument('children-categories-number', InputArgument::OPTIONAL, "Number of children for each category created (default: 0 - use '-1' for random from 0 to 5)")
26
+                ->addArgument('category-name-prefix', InputArgument::OPTIONAL, "Category Name Prefix (default: 'My Awesome Category')")
27
+                ->setDescription('Create a dummy category');
28 28
     }
29 29
 
30 30
     /**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
             // Check if product exists
58 58
             $collection = Mage::getModel('catalog/category')->getCollection()
59
-                              ->addAttributeToSelect('name')
60
-                              ->addAttributeToFilter('name', array('eq' => $name));
59
+                                ->addAttributeToSelect('name')
60
+                                ->addAttributeToFilter('name', array('eq' => $name));
61 61
             $_size = $collection->getSize();
62 62
             if($_size > 0) {
63 63
                 $output->writeln("<comment>CATEGORY: WITH NAME: '".$name."' EXISTS! Skip</comment>");
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
         /**
47 47
          * Loop to create categories
48 48
          */
49
-        for($i = 0; $i < $_argument['category-number']; $i++) {
50
-            if(!is_null($_argument['category-name-prefix'])) {
51
-                $name = $_argument['category-name-prefix']." ".$i;
49
+        for ($i = 0; $i < $_argument['category-number']; $i++) {
50
+            if (!is_null($_argument['category-name-prefix'])) {
51
+                $name = $_argument['category-name-prefix'] . " " . $i;
52 52
             }
53 53
             else {
54
-                $name = self::DEFAULT_CATEGORY_NAME." ".$i;
54
+                $name = self::DEFAULT_CATEGORY_NAME . " " . $i;
55 55
             }
56 56
 
57 57
             // Check if product exists
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
                               ->addAttributeToSelect('name')
60 60
                               ->addAttributeToFilter('name', array('eq' => $name));
61 61
             $_size = $collection->getSize();
62
-            if($_size > 0) {
63
-                $output->writeln("<comment>CATEGORY: WITH NAME: '".$name."' EXISTS! Skip</comment>");
62
+            if ($_size > 0) {
63
+                $output->writeln("<comment>CATEGORY: WITH NAME: '" . $name . "' EXISTS! Skip</comment>");
64 64
                 $_argument['category-number']++;
65 65
                 continue;
66 66
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $category->setDisplayMode('PRODUCTS');
75 75
             $category->setIsAnchor(self::DEFAULT_CATEGORY_ANCHOR);
76 76
 
77
-            if(Mage::getVersion() === "1.5.1.0") {
77
+            if (Mage::getVersion() === "1.5.1.0") {
78 78
                 $category->setStoreId(array(0, $_argument['store-id']));
79 79
             }
80 80
             else {
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 
86 86
             $category->save();
87 87
             $_parent_id = $category->getId();
88
-            $output->writeln("<comment>CATEGORY: '".$category->getName()."' WITH ID: '".$category->getId()."' CREATED!</comment>");
88
+            $output->writeln("<comment>CATEGORY: '" . $category->getName() . "' WITH ID: '" . $category->getId() . "' CREATED!</comment>");
89 89
             unset($category);
90 90
 
91 91
             // Create children Categories
92
-            for($j = 0; $j < $_argument['children-categories-number']; $j++) {
93
-                $name_child = $name." child ".$j;
92
+            for ($j = 0; $j < $_argument['children-categories-number']; $j++) {
93
+                $name_child = $name . " child " . $j;
94 94
 
95 95
                 $category = Mage::getModel('catalog/category');
96 96
                 $category->setName($name_child);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 $category->setDisplayMode('PRODUCTS');
99 99
                 $category->setIsAnchor(self::DEFAULT_CATEGORY_ANCHOR);
100 100
 
101
-                if(Mage::getVersion() === "1.5.1.0") {
101
+                if (Mage::getVersion() === "1.5.1.0") {
102 102
                     $category->setStoreId(array(0, $_argument['store-id']));
103 103
                 }
104 104
                 else {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 $category->setPath($parentCategory->getPath());
109 109
 
110 110
                 $category->save();
111
-                $output->writeln("<comment>CATEGORY CHILD: '".$category->getName()."' WITH ID: '".$category->getId()."' CREATED!</comment>");
111
+                $output->writeln("<comment>CATEGORY CHILD: '" . $category->getName() . "' WITH ID: '" . $category->getId() . "' CREATED!</comment>");
112 112
                 unset($category);
113 113
             }
114 114
         }
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
         $_argument = array();
129 129
 
130 130
         // Store ID
131
-        if(is_null($input->getArgument('store-id'))) {
131
+        if (is_null($input->getArgument('store-id'))) {
132 132
             $store_id = Mage::getModel('core/store')->getCollection()
133 133
                             ->addFieldToSelect('*')
134 134
                             ->addFieldToFilter('store_id', array('gt' => 0))
135 135
                             ->setOrder('store_id', 'ASC');
136 136
             $_store_ids = array();
137 137
 
138
-            foreach($store_id as $item) {
139
-                $_store_ids[$item['store_id']] = $item['store_id']."|".$item['code'];
138
+            foreach ($store_id as $item) {
139
+                $_store_ids[$item['store_id']] = $item['store_id'] . "|" . $item['code'];
140 140
             }
141 141
 
142 142
             $question = new ChoiceQuestion('Please select Store ID (default: 1)', $_store_ids, self::DEFAULT_STORE_ID);
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
             $response = explode("|", $helper->ask($input, $output, $question));
145 145
             $input->setArgument('store-id', $response[0]);
146 146
         }
147
-        $output->writeln('<info>Store ID selected: '.$input->getArgument('store-id')."</info>");
147
+        $output->writeln('<info>Store ID selected: ' . $input->getArgument('store-id') . "</info>");
148 148
         $_argument['store-id'] = $input->getArgument('store-id');
149 149
 
150 150
         // Number of Categories
151
-        if(is_null($input->getArgument('category-number'))) {
151
+        if (is_null($input->getArgument('category-number'))) {
152 152
             $question = new Question("Please enter the number of categories to create (default 1): ", 1);
153
-            $question->setValidator(function($answer) {
154
-                $answer = (int)($answer);
155
-                if(!is_int($answer) || $answer <= 0) {
153
+            $question->setValidator(function ($answer) {
154
+                $answer = (int) ($answer);
155
+                if (!is_int($answer) || $answer <= 0) {
156 156
                     throw new \RuntimeException('Please enter an integer value or > 0');
157 157
                 }
158 158
 
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
             });
161 161
             $input->setArgument('category-number', $helper->ask($input, $output, $question));
162 162
         }
163
-        $output->writeln('<info>Number of categories to create: '.$input->getArgument('category-number')."</info>");
163
+        $output->writeln('<info>Number of categories to create: ' . $input->getArgument('category-number') . "</info>");
164 164
         $_argument['category-number'] = $input->getArgument('category-number');
165 165
 
166 166
         // Number of children categories
167
-        if(is_null($input->getArgument('children-categories-number'))) {
167
+        if (is_null($input->getArgument('children-categories-number'))) {
168 168
             $question = new Question("Number of children for each category created (default: 0 - use '-1' for random from 0 to 5): ", 0);
169
-            $question->setValidator(function($answer) {
170
-                $answer = (int)($answer);
171
-                if(!is_int($answer) || $answer < -1) {
169
+            $question->setValidator(function ($answer) {
170
+                $answer = (int) ($answer);
171
+                if (!is_int($answer) || $answer < -1) {
172 172
                     throw new \RuntimeException("Please enter an integer value or >= -1");
173 173
                 }
174 174
 
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
             });
177 177
             $input->setArgument('children-categories-number', $helper->ask($input, $output, $question));
178 178
         }
179
-        if($input->getArgument('children-categories-number') == -1)
179
+        if ($input->getArgument('children-categories-number') == -1)
180 180
             $input->setArgument('children-categories-number', rand(0, 5));
181 181
 
182
-        $output->writeln('<info>Number of categories children to create: '.$input->getArgument('children-categories-number')."</info>");
182
+        $output->writeln('<info>Number of categories children to create: ' . $input->getArgument('children-categories-number') . "</info>");
183 183
         $_argument['children-categories-number'] = $input->getArgument('children-categories-number');
184 184
 
185 185
         // Category name prefix
186
-        if(is_null($input->getArgument('category-name-prefix'))) {
187
-            $question = new Question("Please enter the category name prefix (default '".self::DEFAULT_CATEGORY_NAME."'): ", self::DEFAULT_CATEGORY_NAME);
186
+        if (is_null($input->getArgument('category-name-prefix'))) {
187
+            $question = new Question("Please enter the category name prefix (default '" . self::DEFAULT_CATEGORY_NAME . "'): ", self::DEFAULT_CATEGORY_NAME);
188 188
             $input->setArgument('category-name-prefix', $helper->ask($input, $output, $question));
189 189
         }
190
-        $output->writeln('<info>CATEGORY NAME PREFIX: '.$input->getArgument('category-name-prefix')."</info>");
190
+        $output->writeln('<info>CATEGORY NAME PREFIX: ' . $input->getArgument('category-name-prefix') . "</info>");
191 191
         $_argument['category-name-prefix'] = $input->getArgument('category-name-prefix');
192 192
 
193 193
         return $_argument;
Please login to merge, or discard this patch.
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
         for($i = 0; $i < $_argument['category-number']; $i++) {
50 50
             if(!is_null($_argument['category-name-prefix'])) {
51 51
                 $name = $_argument['category-name-prefix']." ".$i;
52
-            }
53
-            else {
52
+            } else {
54 53
                 $name = self::DEFAULT_CATEGORY_NAME." ".$i;
55 54
             }
56 55
 
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
 
77 76
             if(Mage::getVersion() === "1.5.1.0") {
78 77
                 $category->setStoreId(array(0, $_argument['store-id']));
79
-            }
80
-            else {
78
+            } else {
81 79
                 $category->setStoreId($_argument['store-id']);
82 80
             }
83 81
             $parentCategory = Mage::getModel('catalog/category')->load($_category_root_id);
@@ -100,8 +98,7 @@  discard block
 block discarded – undo
100 98
 
101 99
                 if(Mage::getVersion() === "1.5.1.0") {
102 100
                     $category->setStoreId(array(0, $_argument['store-id']));
103
-                }
104
-                else {
101
+                } else {
105 102
                     $category->setStoreId($_argument['store-id']);
106 103
                 }
107 104
                 $parentCategory = Mage::getModel('catalog/category')->load($_parent_id);
@@ -176,8 +173,9 @@  discard block
 block discarded – undo
176 173
             });
177 174
             $input->setArgument('children-categories-number', $helper->ask($input, $output, $question));
178 175
         }
179
-        if($input->getArgument('children-categories-number') == -1)
180
-            $input->setArgument('children-categories-number', rand(0, 5));
176
+        if($input->getArgument('children-categories-number') == -1) {
177
+                    $input->setArgument('children-categories-number', rand(0, 5));
178
+        }
181 179
 
182 180
         $output->writeln('<info>Number of categories children to create: '.$input->getArgument('children-categories-number')."</info>");
183 181
         $_argument['children-categories-number'] = $input->getArgument('children-categories-number');
Please login to merge, or discard this patch.
src/N98/Magento/Command/Eav/Attribute/Create/DummyCommand.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 - en_GB
234 234
 HELP;
235 235
         $this->setName('eav:attribute:create-dummy-values')->addArgument('locale', InputArgument::OPTIONAL, 'Locale')
236
-             ->addArgument('attribute-id', InputArgument::OPTIONAL, 'Attribute ID to add values')
237
-             ->addArgument('values-type', InputArgument::OPTIONAL, 'Types of Values to create (default int)')
238
-             ->addArgument('values-number', InputArgument::OPTIONAL, 'Number of Values to create (default 1)')
239
-             ->setDescription('Create a dummy values for dropdown attributes')
240
-             ->setHelp($help);
236
+                ->addArgument('attribute-id', InputArgument::OPTIONAL, 'Attribute ID to add values')
237
+                ->addArgument('values-type', InputArgument::OPTIONAL, 'Types of Values to create (default int)')
238
+                ->addArgument('values-number', InputArgument::OPTIONAL, 'Number of Values to create (default 1)')
239
+                ->setDescription('Create a dummy values for dropdown attributes')
240
+                ->setHelp($help);
241 241
     }
242 242
 
243 243
     /**
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
         // Attribute ID
299 299
         if(is_null($input->getArgument('attribute-id'))) {
300 300
             $attribute_code = Mage::getModel('eav/entity_attribute')->getCollection()->addFieldToSelect('*')
301
-                                  ->addFieldToFilter('entity_type_id', array('eq' => 4))
302
-                                  ->addFieldToFilter('backend_type', array('in' => array('int')))
303
-                                  ->setOrder('attribute_id', 'ASC');
301
+                                    ->addFieldToFilter('entity_type_id', array('eq' => 4))
302
+                                    ->addFieldToFilter('backend_type', array('in' => array('int')))
303
+                                    ->setOrder('attribute_id', 'ASC');
304 304
             $_attribute_codes = array();
305 305
 
306 306
             foreach($attribute_code as $item) {
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         'Atm Anthony Thomas Melillo', 'Aurelia Probiotic Skincare', 'Aurelie Bidermann', 'Ava Adore', 'Avant Toi',
40 40
         'Avelon', 'Awake', 'B May', 'Badgley Mischka', 'Baja East', 'Bakel', 'Balenciaga Eyewear', 'Balenciaga Vintage',
41 41
         'Ballin', 'Bally', 'Balmain', 'Bao Bao Issey Miyake', 'Barbara Bui', 'Barbara Casasola', 'Barbara I Gongini',
42
-        'Bark', 'Barn\'s', 'Barrie',  'Bassike', 'Bata', 'Bazar Deluxe', 'Bea Bongiasca', 'Beau Souci', 'Becca',
42
+        'Bark', 'Barn\'s', 'Barrie', 'Bassike', 'Bata', 'Bazar Deluxe', 'Bea Bongiasca', 'Beau Souci', 'Becca',
43 43
         'Beek..', 'Bella Freud', 'Belstaff', 'Bernhard Willhelm', 'Beth Orduna', 'Bhindi Jewelers', 'Bianca Spender',
44 44
         'Biba Vintage', 'Bibi Van Der Velden', 'Bintthani', 'Bionda Castana', 'Birkenstock', 'Bjorg', 'Blancha',
45 45
         'Blk Dnm', 'Blugirl', 'Blumarine', 'Boboutic', 'Borbonese', 'Bottega Veneta Eyewear', 'Boutique Moschino',
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         'Gcds', 'Gedebe', 'Gemco', 'Geoffrey B. Small', 'Getting Back To Square One', 'Giada Benincasa', 'Giamba',
87 87
         'Giambattista Valli', 'Gianfranco Ferre Vintage', 'Gianluca Capannolo', 'Gianvito Rossi', 'Gig',
88 88
         'Gigi Burris Millinery', 'Gigli Vintage', 'GINGER & SMART', 'Giorgio Armani', 'Giorgio Armani Vintage',
89
-        'Giorgio Brato', 'Gisele For Eshvi', 'Giuliana Romanno', 'Giuseppe Zanotti Design','Givenchy',
89
+        'Giorgio Brato', 'Gisele For Eshvi', 'Giuliana Romanno', 'Giuseppe Zanotti Design', 'Givenchy',
90 90
         'Givenchy Vintage', 'Gold And Wood', 'Golden Goose Deluxe Brand', 'Goldfaden Md', 'Goldsign',
91 91
         'Good For Nothing Emb', 'Goti', 'Goyard Vintage', 'Greg Lauren', 'Grenson', 'Greta Constantine', 'Grey Ant',
92 92
         'Grey Jason Wu', 'G-Star', 'Gucci Eyewear', 'Guidi', 'Guild Prime', 'Guy Laroche Vintage', 'Hache',
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         'Isabel Benenato', 'Isabel Marant', 'Isabel Marant Étoile', 'Isabel Marant For Oliver Peoples', 'Isolda',
103 103
         'Issey Miyake', 'Issey Miyake Cauliflower', 'Issey Miyake Men', 'Issey Miyake Vintage', 'Italia Independent',
104 104
         'Ivo Scunzani', 'Ivy & Liv', 'Ivy Kirzhner', 'J Brand', 'J.W. Anderson', 'Jacob Cohen', 'Jacquemus',
105
-        'Jacques Marie Mage', 'Jacquie Aiche', 'Jagga', 'James Perse','James Read', 'Jamin Puech', 'Jane Bowler',
105
+        'Jacques Marie Mage', 'Jacquie Aiche', 'Jagga', 'James Perse', 'James Read', 'Jamin Puech', 'Jane Bowler',
106 106
         'Janis Savitt', 'Japsis Jewellery', 'Jason Wu', 'Jay Ahr', 'Jc De Castelbajac Vintage',
107 107
         'Jean Louis Scherrer Vintage', 'Jean Paul Gaultier Vintage', 'Jean-François Mimilla', 'Jean-Michel Cazabat',
108 108
         'Jeffrey Campbell', 'Jenni Kayne', 'Jeremy Deller', 'Jeremy Scott', 'Jérôme Dreyfuss', 'Jessie Harris',
@@ -136,20 +136,20 @@  discard block
 block discarded – undo
136 136
         'Marchesa', 'Marchesa Notte', 'Marco De Vincenzo', 'Maria Black', 'Maria Lucia Hohan', 'Maria Teresa Sottile',
137 137
         'Marie Helene De Taillac', 'Mark Cross', 'Markus Lupfer', 'Marni', 'Marsèll', 'Marshall', 'Martha Medeiros',
138 138
         'Martine Jarlgaard', 'Mary Katrantzou', 'Mary Katrantzou X Adidas Originals', 'Maryam Nassir Zadeh',
139
-        'Marysia', 'Masnada', 'Massimo Alba', 'Master & Dynamic', 'Masunaga', 'Matar', 'Mathilde Danglade','Maticevski',
139
+        'Marysia', 'Masnada', 'Massimo Alba', 'Master & Dynamic', 'Masunaga', 'Matar', 'Mathilde Danglade', 'Maticevski',
140 140
         'Matsuda', 'Matthew Darbyshire', 'Matthew Williamson', 'Mawi', 'Max Mara', 'Max Mara Studio', 'Max Tan',
141 141
         'Maxime Llorens', 'Maxwell Snow', 'MCM', 'Mcm Vintage', 'McQ Alexander McQueen', 'Me&Mr.Gentleman',
142 142
         'Melissa + Jeremy Scott', 'Melissa Joy Manning', 'Melissa Odabash', 'Mes Demoiselles', 'Miahatami', 'Miansai',
143 143
         'Michael Kors', 'Michael Michael Kors', 'Michael Schmidt', 'Michel Vivien', 'Micol Ragni', 'Mih Jeans',
144 144
         'Mihara Yasuhiro', 'Milly', 'Minimarket', 'Minjukim', 'Minna Parikka', 'Mira Mikati', 'Missoni',
145
-        'Missoni Vintage',  'Miu Miu Eyewear', 'Mm6 Maison Margiela', 'Moa Master Of Arts',  'Moeva', 'Monan',
146
-        'Moncler', 'Moncler Gamme Rouge', 'Moncler Grenoble', 'Moncler X Erdem',  'Monday Active', 'Monica Sordo',
145
+        'Missoni Vintage', 'Miu Miu Eyewear', 'Mm6 Maison Margiela', 'Moa Master Of Arts', 'Moeva', 'Monan',
146
+        'Moncler', 'Moncler Gamme Rouge', 'Moncler Grenoble', 'Moncler X Erdem', 'Monday Active', 'Monica Sordo',
147 147
         'Monies', 'Monique Lhuillier', 'Monocle Eyewear', 'Monreal London', 'Moo Piyasombatkul', 'Moohong',
148 148
         'Moratorium', 'Moreau', 'Moschino', 'Moschino Vintage', 'Mother', 'Mother Of Pearl', 'Mou', 'Movitra',
149 149
         'Mr & Mrs Italy', 'MSGM', 'Mua Mua', 'Mugler', 'Murmur', 'Musée', 'Muubaa', 'Muveil', 'Mykita',
150 150
         'Myriam Schaefer', 'Myswear', 'N.Peal', 'Nafsika Skourti', 'Narciso Rodriguez', 'Nasir Mazhar',
151 151
         'Natasha Collis', 'Natasha Zinko', 'Nathalie Trad', 'Natura Bisse', 'Neil Barrett', 'Nektar De Stagni',
152
-        'Neuw', 'Nevermind',  'New Balance', 'Newbark', 'Nicholas Kirkwood', 'Nicole Miller', 'Nicopanda',
152
+        'Neuw', 'Nevermind', 'New Balance', 'Newbark', 'Nicholas Kirkwood', 'Nicole Miller', 'Nicopanda',
153 153
         'Night Market', 'Nike', 'Nikos Koulis', 'Nili Lotan', 'Nina Ricci', 'Nina Ricci Vintage', 'Nixon', 'Niza Huang',
154 154
         'Nº21', 'Nobody Denim', 'Nomia', 'Noor Fares', 'Noritamy', 'Norma Kamali', 'Norse Projects', 'NSF', 'Nuface',
155 155
         'O&M', 'Oamc', 'Obey', 'Occulter', 'Odeeh', 'Odeur', 'Of Rare Origin', 'Officine Creative', 'Off-White',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     protected function execute(InputInterface $input, OutputInterface $output)
250 250
     {
251 251
         $this->detectMagento($output, true);
252
-        if(!$this->initMagento()) {
252
+        if (!$this->initMagento()) {
253 253
             return;
254 254
         }
255 255
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
         // Ask for Arguments
259 259
         $_argument = $this->askForArguments($input, $output);
260
-        if(!in_array($input->getArgument('locale'), $this->supportedLocales)) {
260
+        if (!in_array($input->getArgument('locale'), $this->supportedLocales)) {
261 261
             $output->writeln(sprintf("<warning>Locale '%s' not supported, switch to default locale 'us_US'.</warning>", $input->getArgument('locale')));
262 262
             $_argument['locale'] = "en_US";
263 263
         } else {
@@ -266,18 +266,18 @@  discard block
 block discarded – undo
266 266
 
267 267
         /** @var $attribute Mage_Eav_Model_Entity_Attribute */
268 268
         $attribute = Mage::getModel('eav/entity_attribute')->load($_argument['attribute-id']);
269
-        for($i = 0; $i < $_argument['values-number']; $i++) {
269
+        for ($i = 0; $i < $_argument['values-number']; $i++) {
270 270
 
271 271
             $value = $this->createValue($_argument['values-type'], $_argument['locale']);
272
-            if(!$this->attributeValueExists($attribute, $value)) {
272
+            if (!$this->attributeValueExists($attribute, $value)) {
273 273
                 try {
274 274
                     $attribute->setData('option', array('value' => array('option' => array($value, $value))));
275 275
                     $attribute->save();
276
-                } catch(\Exception $e) {
277
-                    $output->writeln("<error>".$e->getMessage()."</error>");
276
+                } catch (\Exception $e) {
277
+                    $output->writeln("<error>" . $e->getMessage() . "</error>");
278 278
                     die;
279 279
                 }
280
-                $output->writeln("<comment>ATTRIBUTE VALUE: '".$value."' ADDED!</comment>\r");
280
+                $output->writeln("<comment>ATTRIBUTE VALUE: '" . $value . "' ADDED!</comment>\r");
281 281
             }
282 282
         }
283 283
     }
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
         $_argument = array();
297 297
 
298 298
         // Attribute ID
299
-        if(is_null($input->getArgument('attribute-id'))) {
299
+        if (is_null($input->getArgument('attribute-id'))) {
300 300
             $attribute_code = Mage::getModel('eav/entity_attribute')->getCollection()->addFieldToSelect('*')
301 301
                                   ->addFieldToFilter('entity_type_id', array('eq' => 4))
302 302
                                   ->addFieldToFilter('backend_type', array('in' => array('int')))
303 303
                                   ->setOrder('attribute_id', 'ASC');
304 304
             $_attribute_codes = array();
305 305
 
306
-            foreach($attribute_code as $item) {
307
-                $_attribute_codes[$item['attribute_id']] = $item['attribute_id']."|".$item['attribute_code'];
306
+            foreach ($attribute_code as $item) {
307
+                $_attribute_codes[$item['attribute_id']] = $item['attribute_id'] . "|" . $item['attribute_code'];
308 308
             }
309 309
 
310 310
             $question = new ChoiceQuestion('Please select Attribute ID', $_attribute_codes);
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
             $response = explode("|", $helper->ask($input, $output, $question));
313 313
             $input->setArgument('attribute-id', $response[0]);
314 314
         }
315
-        $output->writeln('<info>Attribute code selected: '.$input->getArgument('attribute-id')."</info>");
316
-        $_argument['attribute-id'] = (int)$input->getArgument('attribute-id');
315
+        $output->writeln('<info>Attribute code selected: ' . $input->getArgument('attribute-id') . "</info>");
316
+        $_argument['attribute-id'] = (int) $input->getArgument('attribute-id');
317 317
 
318 318
         // Type of Values
319
-        if(is_null($input->getArgument('values-type'))) {
319
+        if (is_null($input->getArgument('values-type'))) {
320 320
 
321 321
             $valueTypes = array('int'      => 'int',
322 322
                                 'string'   => 'string',
@@ -329,15 +329,15 @@  discard block
 block discarded – undo
329 329
             $question->setErrorMessage('Attribute Value Type "%s" is invalid.');
330 330
             $input->setArgument('values-type', $helper->ask($input, $output, $question));
331 331
         }
332
-        $output->writeln('<info>Attribute Value Type selected: '.$input->getArgument('values-type')."</info>");
332
+        $output->writeln('<info>Attribute Value Type selected: ' . $input->getArgument('values-type') . "</info>");
333 333
         $_argument['values-type'] = $input->getArgument('values-type');
334 334
 
335 335
         // Number of Values
336
-        if(is_null($input->getArgument('values-number'))) {
336
+        if (is_null($input->getArgument('values-number'))) {
337 337
             $question = new Question("Please enter the number of values to create (default 1): ", 1);
338
-            $question->setValidator(function($answer) {
339
-                $answer = (int)($answer);
340
-                if(!is_int($answer) || $answer <= 0) {
338
+            $question->setValidator(function ($answer) {
339
+                $answer = (int) ($answer);
340
+                if (!is_int($answer) || $answer <= 0) {
341 341
                     throw new \RuntimeException('Please enter an integer value or > 0');
342 342
                 }
343 343
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             });
346 346
             $input->setArgument('values-number', $helper->ask($input, $output, $question));
347 347
         }
348
-        $output->writeln('<info>Number of values to create: '.$input->getArgument('values-number')."</info>");
348
+        $output->writeln('<info>Number of values to create: ' . $input->getArgument('values-number') . "</info>");
349 349
         $_argument['values-number'] = $input->getArgument('values-number');
350 350
 
351 351
         return $_argument;
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
      */
361 361
     private function createValue($type, $locale)
362 362
     {
363
-        if(!isset($this->faker)) {
363
+        if (!isset($this->faker)) {
364 364
             $this->faker = \Faker\Factory::create($locale);
365 365
         }
366 366
 
367
-        switch($type) {
367
+        switch ($type) {
368 368
             case 'int':
369 369
                 $value = $this->faker->randomNumber();
370 370
                 break;
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
         $options->setAttribute($attribute);
402 402
         $options = $options->getAllOptions(false);
403 403
 
404
-        foreach($options as $option) {
405
-            if($option['label'] === $arg_value) {
404
+        foreach ($options as $option) {
405
+            if ($option['label'] === $arg_value) {
406 406
                 return true;
407 407
             }
408 408
         }
Please login to merge, or discard this patch.