Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scrutinizer] remove unused-code #1226

Merged
merged 4 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ public function getCarrierDetails(CartInterface $cart)
$price = $this->get('coreshop.carrier.price_calculator.taxed')->getPrice(
$carrier,
$cart,
$cart->getShippingAddress()
);
$priceConverted = $this->get('coreshop.currency_converter')->convert(
$price,
$currentCurrency,
$cart->getCurrency()->getIsoCode()
);
$cart->getShippingAddress()
);

$result[] = [
'id' => $carrier->getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function searchAction(Request $request)

protected function createSearchForm()
{
return $form = $this->get('form.factory')->createNamed('search', SearchType::class, null, [
return $this->get('form.factory')->createNamed('search', SearchType::class, null, [
'action' => $this->generateCoreShopUrl(null, 'coreshop_search'),
'method' => 'GET',
]);
Expand Down
1 change: 0 additions & 1 deletion src/CoreShop/Bundle/IndexBundle/Worker/AbstractWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ protected function processGetter(IndexColumnInterface $column, IndexableInterfac
{
$getter = $column->getGetter();
$getterClass = $this->getterServiceRegistry->get($getter);
$value = null;

Assert::isInstanceOf($getterClass, GetterInterface::class);

Expand Down
2 changes: 1 addition & 1 deletion src/CoreShop/Bundle/IndexBundle/Worker/MysqlWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected function typeCastValueSQLDecleration(IndexColumnInterface $column)
*/
protected function handleArrayValues(IndexInterface $index, array $value)
{
return ',' . implode($value, ',') . ',';
return ',' . implode(',', $value) . ',';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ protected function prepareCartItem(CartInterface $cart, CartItemInterface $item)
$currency = $cart->getStore()->getCurrency()->getIsoCode();

$moneyConverter = $this->get('coreshop.currency_converter');
$moneyFormatter = $this->get('coreshop.money_formatter');

$price = $item->getItemPrice();
$total = $item->getTotal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function findExpiredCarts($days, $anonymous, $customer)
$params = [];

$daysTimestamp = Carbon::now();
$daysTimestamp->subDay($days);
$daysTimestamp->subDays($days);

$conditions[] = 'o_creationDate < ?';
$params[] = $daysTimestamp->getTimestamp();
Expand Down
2 changes: 0 additions & 2 deletions src/CoreShop/Bundle/TrackingBundle/Tracker/Matomo/Matomo.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ private function filterCategories($categories, int $limit = 5)
return $categories;
}

$result = null;

if (is_array($categories)) {
// add max 5 categories
$categories = array_slice($categories, 0, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function __construct(CountryRepositoryInterface $countryRepository)
public function findCountry(Request $request)
{
$geoDbFile = PIMCORE_CONFIGURATION_DIRECTORY . '/GeoLite2-City.mmdb';
$record = null;

if (file_exists($geoDbFile)) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function __construct(MailActionProcessor $mailActionProcessor)
*/
public function apply($subject, NotificationRuleInterface $rule, array $configuration, $params = [])
{
$language = null;
$store = null;
$mails = $configuration['mails'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function __construct(OrderMailActionProcessor $orderMailActionProcessor)
*/
public function apply($subject, NotificationRuleInterface $rule, array $configuration, $params = [])
{
$language = null;
$store = null;
$mails = $configuration['mails'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function transform(ProposalInterface $proposal, ProposalItemInterface $fr
if ($fromProposalItem instanceof CartItemInterface && $toProposal instanceof SaleItemInterface) {
$toProposal->setDigitalProduct($fromProposalItem->getDigitalProduct());
$toProposal->setObjectId($fromProposalItem->getProduct()->getId());
$mainObjectId = null;

if ($fromProposalItem->getProduct() instanceof ProductInterface) {
if ($fromProposalItem->getProduct()->getType() === AbstractObject::OBJECT_TYPE_VARIANT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function getRetailPrice(ProductInterface $subject, array $context)
Assert::keyExists($context, 'store');
Assert::isInstanceOf($context['store'], StoreInterface::class);

$price = null;

if (!isset($context['unitDefinition']) || !$context['unitDefinition'] instanceof ProductUnitDefinitionInterface) {
throw new NoRetailPriceFoundException(__CLASS__);
}
Expand Down
6 changes: 2 additions & 4 deletions src/CoreShop/Component/Pimcore/DataObject/ClassInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ class ClassInstaller implements ClassInstallerInterface
*/
public function createBrick($jsonFile, $brickName)
{
$objectBrick = null;

try {
$objectBrick = DataObject\Objectbrick\Definition::getByKey($brickName);
} catch (\Exception $e) {
$objectBrick = null;
}

if (null === $objectBrick) {
Expand Down Expand Up @@ -97,11 +96,10 @@ public function createClass($jsonFile, $className, $updateClass = false)
*/
public function createFieldCollection($jsonFile, $name)
{
$fieldCollection = null;

try {
$fieldCollection = DataObject\Fieldcollection\Definition::getByKey($name);
} catch (\Exception $e) {
$fieldCollection = null;
}

if (null === $fieldCollection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function initializeObjectType(ClassMetadataInfo $entityMetaType)

foreach ($entityMetaType->getFieldNames() as $fieldName) {
$fieldType = $this->mapFieldType($entityMetaType->getTypeOfField($fieldName));
$resolverClass = null;

$resolver = new DoctrineField($fieldName, $fieldType);
$fields[$fieldName] = $resolver->getDefinition();
$inputFields[$fieldName] = array(
Expand Down