Skip to content

Commit

Permalink
perf: Applied phpcs and phpmd rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jansentjeu committed Mar 29, 2024
1 parent 9118f3e commit 04b283f
Show file tree
Hide file tree
Showing 58 changed files with 301 additions and 203 deletions.
4 changes: 2 additions & 2 deletions src/Api/Data/FilterInterface.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
*/

namespace Emico\AttributeLanding\Api\Data;


interface FilterInterface
{
/**
Expand All @@ -18,4 +18,4 @@ public function getFacet(): string;
* @return string
*/
public function getValue(): string;
}
}
54 changes: 28 additions & 26 deletions src/Api/Data/LandingPageInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
Expand All @@ -13,29 +14,29 @@ interface LandingPageInterface extends ExtensibleDataInterface
/**
* Field constants
*/
const META_TITLE = 'meta_title';
const CONTENT_LAST = 'content_last';
const ACTIVE = 'active';
const HEADING = 'heading';
const CONTENT_FIRST = 'content_first';
const FILTER_ATTRIBUTES = 'filter_attributes';
const NAME = 'name';
const URL_PATH = 'url_path';
const META_KEYWORDS = 'meta_keywords';
const TWEAKWISE_FILTER_TEMPLATE = 'tweakwise_filter_template';
const TWEAKWISE_SORT_TEMPLATE = 'tweakwise_sort_template';
const HEADER_IMAGE = 'header_image';
const CATEGORY_ID = 'category_id';
const PAGE_ID = 'page_id';
const META_DESCRIPTION = 'meta_description';
const STORE_IDS = 'store_ids';
const OVERVIEW_PAGE_ID = 'overview_page_id';
const OVERVIEW_PAGE_IMAGE = 'overview_page_image';
const FILTER_LINK_ALLOWED = 'is_filter_link_allowed';
const HIDE_SELECTED_FILTERS = 'hide_selected_filters';
const CANONICAL_URL = 'canonical_url';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
public const META_TITLE = 'meta_title';
public const CONTENT_LAST = 'content_last';
public const ACTIVE = 'active';
public const HEADING = 'heading';
public const CONTENT_FIRST = 'content_first';
public const FILTER_ATTRIBUTES = 'filter_attributes';
public const NAME = 'name';
public const URL_PATH = 'url_path';
public const META_KEYWORDS = 'meta_keywords';
public const TWEAKWISE_FILTER_TEMPLATE = 'tweakwise_filter_template';
public const TWEAKWISE_SORT_TEMPLATE = 'tweakwise_sort_template';
public const HEADER_IMAGE = 'header_image';
public const CATEGORY_ID = 'category_id';
public const PAGE_ID = 'page_id';
public const META_DESCRIPTION = 'meta_description';
public const STORE_IDS = 'store_ids';
public const OVERVIEW_PAGE_ID = 'overview_page_id';
public const OVERVIEW_PAGE_IMAGE = 'overview_page_image';
public const FILTER_LINK_ALLOWED = 'is_filter_link_allowed';
public const HIDE_SELECTED_FILTERS = 'hide_selected_filters';
public const CANONICAL_URL = 'canonical_url';
public const CREATED_AT = 'created_at';
public const UPDATED_AT = 'updated_at';

/**
* Set an extension attributes object.
Expand Down Expand Up @@ -151,7 +152,7 @@ public function getFilterAttributes();
* @param string $filterAttributes
* @return \Emico\AttributeLanding\Api\Data\LandingPageInterface
*/
public function setFilterAttributes( ?string $filterAttributes): LandingPageInterface;
public function setFilterAttributes(?string $filterAttributes): LandingPageInterface;

/**
* @return \Emico\AttributeLanding\Api\Data\FilterInterface[]
Expand All @@ -175,11 +176,13 @@ public function getOverviewPageImage();

/**
* @return bool
* @SuppressWarnings(PHPMD.BooleanGetMethodName)
*/
public function getIsFilterLinkAllowed(): bool;

/**
* @return bool
* @SuppressWarnings(PHPMD.BooleanGetMethodName)
*/
public function getHideSelectedFilters(): bool;

Expand All @@ -198,7 +201,6 @@ public function getCreatedAt(): string;
*/
public function getUpdatedAt(): string;


/**
* @param string|null $pageId
* @return LandingPageInterface
Expand All @@ -221,7 +223,7 @@ public function setName(?string $name): LandingPageInterface;
* @param int|null $categoryId
* @return LandingPageInterface
*/
public function setCategoryId( ?int $categoryId): LandingPageInterface;
public function setCategoryId(?int $categoryId): LandingPageInterface;

/**
* @param string|null $heading
Expand Down
31 changes: 16 additions & 15 deletions src/Api/Data/OverviewPageInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
Expand All @@ -11,20 +12,20 @@ interface OverviewPageInterface
/**
* Field constants
*/
const META_TITLE = 'meta_title';
const ACTIVE = 'active';
const HEADING = 'heading';
const CONTENT_FIRST = 'content_first';
const CONTENT_LAST = 'content_last';
const NAME = 'name';
const URL_PATH = 'url_path';
const META_KEYWORDS = 'meta_keywords';
const CATEGORY_ID = 'category_id';
const PAGE_ID = 'page_id';
const META_DESCRIPTION = 'meta_description';
const STORE_IDS = 'store_ids';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
public const META_TITLE = 'meta_title';
public const ACTIVE = 'active';
public const HEADING = 'heading';
public const CONTENT_FIRST = 'content_first';
public const CONTENT_LAST = 'content_last';
public const NAME = 'name';
public const URL_PATH = 'url_path';
public const META_KEYWORDS = 'meta_keywords';
public const CATEGORY_ID = 'category_id';
public const PAGE_ID = 'page_id';
public const META_DESCRIPTION = 'meta_description';
public const STORE_IDS = 'store_ids';
public const CREATED_AT = 'created_at';
public const UPDATED_AT = 'updated_at';

/**
* Get page_id
Expand Down Expand Up @@ -101,4 +102,4 @@ public function getCreatedAt(): string;
* @return string
*/
public function getUpdatedAt(): string;
}
}
1 change: 1 addition & 0 deletions src/Api/Data/OverviewPageSearchResultsInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
Expand Down
1 change: 1 addition & 0 deletions src/Api/Data/PageSearchResultsInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
Expand Down
2 changes: 0 additions & 2 deletions src/Api/LandingPageRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php


namespace Emico\AttributeLanding\Api;


use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
Expand Down
2 changes: 0 additions & 2 deletions src/Api/OverviewPageRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php


namespace Emico\AttributeLanding\Api;


use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
Expand Down
4 changes: 2 additions & 2 deletions src/Api/UrlRewriteGeneratorInterface.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2017
*/

namespace Emico\AttributeLanding\Api;


interface UrlRewriteGeneratorInterface
{
/**
Expand Down Expand Up @@ -34,4 +34,4 @@ public function getUrlRewriteRequestPath(): string;
* @return int[]
*/
public function getStoreIds(): array;
}
}
11 changes: 7 additions & 4 deletions src/Block/Catalog/Breadcrumbs.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
Expand All @@ -17,6 +18,7 @@
use Emico\AttributeLanding\Model\LandingPageContext;
use Magento\Catalog\Block\Breadcrumbs as CatalogBreadcrumbs;
use Magento\Catalog\Helper\Data;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\Element\Template\Context;

class Breadcrumbs extends CatalogBreadcrumbs
Expand All @@ -32,23 +34,24 @@ class Breadcrumbs extends CatalogBreadcrumbs
private $overviewPageRepository;

/**
* @var \Magento\Framework\UrlInterface
* @var UrlInterface
*/
private \Magento\Framework\UrlInterface $urlInterface;
private UrlInterface $urlInterface;

/**
* @param Context $context
* @param Data $catalogData
* @param LandingPageContext $landingPageContext
* @param OverviewPageRepositoryInterface $overviewPageRepository
* @param UrlInterface $urlInterface
* @param array $data
*/
public function __construct(
Context $context,
Data $catalogData,
LandingPageContext $landingPageContext,
OverviewPageRepositoryInterface $overviewPageRepository,
\Magento\Framework\UrlInterface $urlInterface,
UrlInterface $urlInterface,
array $data = []
) {
parent::__construct($context, $catalogData, $data);
Expand Down Expand Up @@ -103,7 +106,7 @@ public function addLandingPageBreadCrumbs(LandingPageInterface $landingPage): vo
[
'label' => __($overviewPage->getName()),
'title' => __($overviewPage->getName()),
'link' => $this->urlInterface->getUrl( $overviewPage->getUrlPath() )
'link' => $this->urlInterface->getUrl($overviewPage->getUrlPath())
]
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Block/LandingPage/Content.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
*/

namespace Emico\AttributeLanding\Block\LandingPage;


use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Model\LandingPageContext;
use Magento\Cms\Model\Template\FilterProvider;
Expand Down Expand Up @@ -85,4 +85,4 @@ protected function getFilteredContent(string $content): string
return '';
}
}
}
}
9 changes: 4 additions & 5 deletions src/Block/LayeredNavigation/Navigation/FilterHidePlugin.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
*/

namespace Emico\AttributeLanding\Block\LayeredNavigation\Navigation;


use Emico\AttributeLanding\Model\FilterHider\FilterHiderInterface;
use Emico\AttributeLanding\Model\LandingPageContext;
use Magento\LayeredNavigation\Block\Navigation;

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
*/

Expand Down Expand Up @@ -41,8 +40,8 @@ public function __construct(LandingPageContext $landingPageContext, FilterHiderI

/**
* @param Navigation $subject
* @param $filters
* @return mixed
* @param array $filters
* @return array
*/
public function afterGetFilters(Navigation $subject, array $filters)
{
Expand All @@ -59,4 +58,4 @@ public function afterGetFilters(Navigation $subject, array $filters)

return $filters;
}
}
}
2 changes: 1 addition & 1 deletion src/Block/OverviewPage/View.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* @author Bram Gerritsen <bgerritsen@emico.nl>
* @copyright (c) Emico B.V. 2019
*/

namespace Emico\AttributeLanding\Block\OverviewPage;


use Emico\AttributeLanding\Api\Data\LandingPageInterface;
use Emico\AttributeLanding\Api\Data\OverviewPageInterface;
use Emico\AttributeLanding\Api\LandingPageRepositoryInterface;
Expand Down
5 changes: 4 additions & 1 deletion src/Console/Command/RegenerateUrlRewrites.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
class RegenerateUrlRewrites extends Command
{
private LandingPageRepositoryInterface $landingPageRepository;

private SearchCriteriaBuilder $searchCriteriaBuilder;

private UrlRewriteService $urlRewriteService;

private OverviewPageRepositoryInterface $overviewPageRepository;

public function __construct(
Expand Down Expand Up @@ -68,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
sprintf('Regenerating urls for %s (%s)', $page->getName(), $page->getId())
);
$this->urlRewriteService->generateRewrite($page);
$counter += 1;
$counter++;
} catch (Exception $e) {
$output->writeln(
sprintf(
Expand Down
1 change: 0 additions & 1 deletion src/Controller/Adminhtml/OverviewPage/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class Index extends OverviewPage
{

protected $resultPageFactory;

/**
Expand Down
2 changes: 0 additions & 2 deletions src/Controller/Adminhtml/OverviewPage/NewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Magento\Backend\App\Action\Context;
use Magento\Backend\Model\View\Result\ForwardFactory;


class NewAction extends OverviewPage
{

protected $resultForwardFactory;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Controller/Adminhtml/Page/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class Index extends Page
{

protected $resultPageFactory;

/**
Expand Down
Loading

0 comments on commit 04b283f

Please sign in to comment.