Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
agranjeon committed May 28, 2019
1 parent 4d2836b commit 53f2b5f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Console/Command/Fake.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$faker->generateFakeData($output);
}

return;
break;
}
$faker = $this->fakerProvider->getFaker($code);
$faker->generateFakeData($output);
Expand Down
4 changes: 2 additions & 2 deletions Model/Faker/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function createCategory(int $parentId, int $depth): void
}

$category = $this->categoryFactory->create();
$name = '';
$name = '';
while (strlen($name) < 1) {
$name = substr($this->faker->realText(20, 3), 0, -1);
}
Expand All @@ -103,7 +103,7 @@ protected function createCategory(int $parentId, int $depth): void
$category->setCustomAttributes(
[
'description' => $this->faker->realText(100, 5),
'meta_title' => $this->faker->realText(20, 3),
'meta_title' => $this->faker->realText(20, 3),
'meta_keywords' => $this->faker->realText(50, 5),
'meta_description' => $this->faker->realText(100, 5),
]
Expand Down
5 changes: 2 additions & 3 deletions Model/Faker/CustomerAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ public function generateFakeData(OutputInterface $output): void
$customers->addFieldToFilter('website_id', ['in' => $this->getStoreConfig('faker/global/website_ids')]);

$progressBar = new ProgressBar(
$output->section(),
$customers->getSize()
$output->section(), $customers->getSize()
);
$progressBar->setFormat(
'<info>%message%</info> %current%/%max% [%bar%] %percent:3s%% %elapsed% %memory:6s%'
Expand All @@ -94,7 +93,7 @@ public function generateFakeData(OutputInterface $output): void
$minAddressNumber = $this->getStoreConfig('faker/customer/min_address_number', $storeId);
$maxAddressNumber = $this->getStoreConfig('faker/customer/max_address_number', $storeId);
$availableCountryId = explode(',', $this->getStoreConfig('general/country/allow', $storeId));
$country = $availableCountryId[array_rand($availableCountryId)];
$country = $availableCountryId[array_rand($availableCountryId)];
$availableRegionId = $this->getAvailableRegionIds($country);
$faker = $this->getFaker($storeId);
$iterationNumber = $faker->numberBetween($minAddressNumber, $maxAddressNumber);
Expand Down
4 changes: 1 addition & 3 deletions Model/Faker/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ public function generateFakeData(OutputInterface $output): void
if ($faker->boolean($ratio) && $order->canInvoice()) {
$invoice = $order->prepareInvoice()->register();
$order->setIsInProcess(true);
$transaction = $this->transactionFactory->create()
->addObject($invoice)
->addObject($order);
$transaction = $this->transactionFactory->create()->addObject($invoice)->addObject($order);

$transaction->save();
}
Expand Down
5 changes: 3 additions & 2 deletions Model/Faker/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function generateFakeData(OutputInterface $output): void
$product,
rand(1, 3) // qty
);
} catch(\Exception $exception) {
} catch (\Exception $exception) {
}
}
if (count($quote->getItemsCollection()->getItems()) == 0) {
Expand All @@ -170,7 +170,7 @@ public function generateFakeData(OutputInterface $output): void
$quote->getPayment()->importData(['method' => $paymentMethod]);
$quote->collectTotals()->save();
$this->quoteManagement->submit($quote);
} catch(\Exception $exception) {
} catch (\Exception $exception) {
}
}
$progressBar->advance();
Expand Down Expand Up @@ -199,6 +199,7 @@ protected function getProductIds(): array
{
$collection = $this->productCollectionFactory->create()->addFieldToFilter('status', ['eq' => true]);
$this->stockFilter->addIsInStockFilterToCollection($collection);

return $collection->getAllIds();
}
}
5 changes: 1 addition & 4 deletions Model/Faker/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ public function generateFakeData(OutputInterface $output): void
$websiteIds = explode(',', $this->getStoreConfig('faker/global/website_ids'));
$faker = $this->getFaker(0);
$categoryIds = $this->categoryCollectionFactory->create()->getAllIds();
$progressBar = new ProgressBar(
$output->section(),
$numberOfProduct
);
$progressBar = new ProgressBar($output->section(), $numberOfProduct);
$progressBar->setFormat(
'<info>%message%</info> %current%/%max% [%bar%] %percent:3s%% %elapsed% %memory:6s%'
);
Expand Down
9 changes: 3 additions & 6 deletions Model/Faker/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,17 @@ public function generateFakeData(OutputInterface $output): void
continue;
}

$qty = $item->getQtyToShip();
$qty = $item->getQtyToShip();
$shipmentItem = $this->orderConverter->itemToShipmentItem($item)->setQty($qty);
$shipment->addItem($shipmentItem);
}
$shipment->register();
$order->setIsInProcess(true);
$transaction = $this->transactionFactory->create()
->addObject($shipment)
->addObject($order);
$transaction = $this->transactionFactory->create()->addObject($shipment)->addObject($order);

$transaction->save();
} catch(\Exception $exception) {
} catch (\Exception $exception) {
}

}
$progressBar->advance();
}
Expand Down

0 comments on commit 53f2b5f

Please sign in to comment.