Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Applied fixes from FlintCI
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh authored and OskarStark committed Feb 12, 2020
1 parent 0c9c9b8 commit 4b6bd48
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 26 deletions.
15 changes: 10 additions & 5 deletions src/Component/Generator/PostgresReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ public function invoice(InvoiceInterface $invoice): void
throw new \RuntimeException('The invoice is not persisted into the database');
}

$this->generateReference($invoice,
$this->registry->getManager()->getClassMetadata(\get_class($invoice))->table['name']);
$this->generateReference(
$invoice,
$this->registry->getManager()->getClassMetadata(\get_class($invoice))->table['name']
);
}

public function order(OrderInterface $order): void
Expand All @@ -45,8 +47,10 @@ public function order(OrderInterface $order): void
throw new \RuntimeException('The order is not persisted into the database');
}

$this->generateReference($order,
$this->registry->getManager()->getClassMetadata(\get_class($order))->table['name']);
$this->generateReference(
$order,
$this->registry->getManager()->getClassMetadata(\get_class($order))->table['name']
);
}

/**
Expand Down Expand Up @@ -75,7 +79,8 @@ private function generateReference($object, $tableName)
$statement = $this->registry->getConnection()->query($sql);
$row = $statement->fetch();

$reference = sprintf('%02d%02d%02d%06d',
$reference = sprintf(
'%02d%02d%02d%06d',
$date->format('y'),
$date->format('n'),
$date->format('j'),
Expand Down
3 changes: 2 additions & 1 deletion src/Component/Payment/Scellius/ScelliusPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ public function applyTransactionId(TransactionInterface $transaction): void
*/
private function getResponseData(TransactionInterface $transaction)
{
$cmd = sprintf('cd %s && %s pathfile=%s message=%s ',
$cmd = sprintf(
'cd %s && %s pathfile=%s message=%s ',
$this->getOption('base_folder'),
$this->getOption('response_command'),
$this->getOption('pathfile'),
Expand Down
4 changes: 3 additions & 1 deletion src/CustomerBundle/Twig/Extension/AddressExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public function renderAddress(\Twig_Environment $environment, $address, $showNam
];
}

return $environment->render('@SonataCustomer/Addresses/_address.html.twig', [
return $environment->render(
'@SonataCustomer/Addresses/_address.html.twig',
[
'address' => $addressArray,
'showName' => $showName,
'showEdit' => $showEdit,
Expand Down
6 changes: 4 additions & 2 deletions src/ProductBundle/Admin/ProductVariationAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function getBaseRoutePattern()
if ('sonata.product.admin.product.variation' === $this->getCode() && !$this->isChild()) { // variation
$this->baseRoutePattern = '/sonata/product/variation';
} elseif ('sonata.product.admin.product.variation' === $this->getCode() && $this->isChild()) { // variation
$this->baseRoutePattern = sprintf('%s/{id}/%s',
$this->baseRoutePattern = sprintf(
'%s/{id}/%s',
$this->getParent()->getBaseRoutePattern(),
$this->urlize('variation', '-')
);
Expand All @@ -56,7 +57,8 @@ public function getBaseRouteName()
if ('sonata.product.admin.product.variation' === $this->getCode() && !$this->isChild()) { // variation
$this->baseRouteName = 'admin_sonata_product_variation';
} elseif ('sonata.product.admin.product.variation' === $this->getCode() && $this->isChild()) { // variation
$this->baseRouteName = sprintf('%s_%s',
$this->baseRouteName = sprintf(
'%s_%s',
$this->getParent()->getBaseRouteName(),
$this->urlize('variation')
);
Expand Down
11 changes: 7 additions & 4 deletions src/ProductBundle/Command/GenerateProductCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ protected function configure(): void
protected function execute(InputInterface $input, OutputInterface $output): void
{
// find a better way to detect the Application folder
$bundle_dir = sprintf('%s/src/Sonata/ProductBundle',
$this->kernel->getProjectDir()
$bundle_dir = sprintf(
'%s/src/Sonata/ProductBundle',
$this->kernel->getProjectDir()
);

if (!is_dir($bundle_dir)) {
Expand Down Expand Up @@ -137,7 +138,8 @@ protected function execute(InputInterface $input, OutputInterface $output): void

$service = $input->getArgument('service_id');

$output->write(Mustache::renderString(<<<CONFIG
$output->write(Mustache::renderString(
<<<CONFIG
<info>1. Add this service definition</info>
Expand Down Expand Up @@ -176,7 +178,8 @@ class: App\Sonata\ProductBundle\Provider\{{ product }}ProductProvider
CONFIG
, ['service' => $service, 'product' => $product]
,
['service' => $service, 'product' => $product]
));
}
}
10 changes: 5 additions & 5 deletions src/ProductBundle/Controller/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class CollectionController extends Controller
private $productSetManager;

public function __construct(
SeoPage $sonataSeoPage = null,
CurrencyDetectorInterface $currencyDetector = null,
CollectionManagerInterface $collectionManagerInterface = null,
ProductSetManager $productSetManager = null
) {
SeoPage $sonataSeoPage = null,
CurrencyDetectorInterface $currencyDetector = null,
CollectionManagerInterface $collectionManagerInterface = null,
ProductSetManager $productSetManager = null
) {
$this->sonataSeoPage = $sonataSeoPage;
$this->currencyDetector = $currencyDetector;
$this->collectionManagerInterface = $collectionManagerInterface;
Expand Down
15 changes: 10 additions & 5 deletions src/ProductBundle/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public function viewAction($productId, $slug)
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$this->get('sonata.product.pool')->getProductCode($product),
$product->getId(),
$action,
Expand All @@ -87,7 +88,8 @@ public function renderFormBasketElementAction(FormView $formView, BasketElementI
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$basketElement->getProductCode(),
$basketElement->getProductId(),
$action,
Expand Down Expand Up @@ -159,7 +161,8 @@ public function renderFinalReviewBasketElementAction(BasketElementInterface $bas
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$basketElement->getProductCode(),
$basketElement->getProductId(),
$action,
Expand Down Expand Up @@ -194,7 +197,8 @@ public function viewVariationsAction($productId, $slug)
]);

if ($this->get('kernel')->isDebug()) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$this->get('sonata.product.pool')->getProductCode($product),
$product->getId(),
$action,
Expand Down Expand Up @@ -262,7 +266,8 @@ public function variationToProductAction(Request $request, $productId, $slug)
]);

if ($this->get('kernel')->isDebug() && !($response instanceof JsonResponse)) {
$response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$response->setContent(sprintf(
"\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
$this->get('sonata.product.pool')->getProductCode($product),
$product->getId(),
$action,
Expand Down
3 changes: 2 additions & 1 deletion src/ProductBundle/Entity/BaseDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ abstract class BaseDelivery implements DeliveryInterface
*/
public function __toString()
{
return sprintf('%s-%s%s',
return sprintf(
'%s-%s%s',
$this->getCode(),
$this->getCountryCode(),
$this->getZone() ? sprintf('%s', $this->getZone()) : ''
Expand Down
2 changes: 1 addition & 1 deletion src/ProductBundle/Model/BaseProductProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ public function defineAddBasketForm(ProductInterface $product, FormBuilder $form
} else {
$transformer = new QuantityTransformer();
$formBuilder->add(
$formBuilder->create('quantity', HiddenType::class, ['data' => 1])
$formBuilder->create('quantity', HiddenType::class, ['data' => 1])
->addModelTransformer($transformer)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function createCollectionController(
?CurrencyDetectorInterface $currencyDetector = null,
?CollectionManagerInterface $collectionManagerInterface = null,
?ProductSetManager $productSetManager = null
): CollectionController {
): CollectionController {
if (!$sonataSeoPage) {
$sonataSeoPage = new SeoPage('Collection page');
}
Expand Down

0 comments on commit 4b6bd48

Please sign in to comment.