Showing 121 of 156 total issues
Function findCurrentCategory
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function findCurrentCategory($items) {
$storeId = $this->filter->getStoreId();
$currentCategory = $this->filter->getLayer()->getCurrentCategory();
$tweakwiseCategoryId = $this->helper->getTweakwiseId($storeId, $currentCategory->getId());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function initFilters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function initFilters(Layer $layer)
{
$request = $this->context->getRequest();
if (!$request->hasParameter('tn_cid')) {
$request->addCategoryFilter($layer->getCurrentCategory());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
UrlInterface $url,
Registry $registry,
Config $config,
StoreManagerInterface $storeManager,
CategoryRepositoryInterface $categoryRepository,
Method getCurrentQueryUrl
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getCurrentQueryUrl(MagentoHttpRequest $request, array $query)
{
$selectedFilters = $request->getQuery();
$reservedParams = [
self::PARAM_LIMIT,
Method getAttributeSelectUrl
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAttributeSelectUrl(MagentoHttpRequest $request, Item $item): string
{
$settings = $item
->getFilter()
->getFacet()
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
DataProviderHelper $dataProviderHelper,
Config $config,
Client $client,
RequestFactory $autocompleteRequestFactory,
StoreManagerInterface $storeManager,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
Attribute $eavAttribute,
AttributeFactory $layerAttribute,
Data $swatchHelper,
Media $mediaHelper,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
PriceHelper $priceHelper,
TaxHelper $taxHelper,
Config $config,
NavigationConfig $navigationConfig,
FilterHelper $filterHelper,
Method getSwatchMap
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getSwatchMap(): array
{
if ($this->swatchMap !== null) {
return $this->swatchMap;
}
Function getCurrentQueryUrl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getCurrentQueryUrl(MagentoHttpRequest $request, array $query)
{
$selectedFilters = $request->getQuery();
$reservedParams = [
self::PARAM_LIMIT,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addParameter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addParameter($parameter, $value, $separator = '|')
{
if (isset($this->parameters[$parameter])) {
if ($value == null) {
unset($this->parameters[$parameter]);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getFinalPrice
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getFinalPrice()
{
$attributes = $this->getDataValue('attributes');
if (!empty($attributes['attribute'])) {
foreach ($attributes['attribute'] as $attribute) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method isFilterValueItemInWhiteList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function isFilterValueItemInWhiteList(Item $item): bool
{
$filterValuesWhiteList = $this->config->getFilterValuesWhitelist();
$attributeValue = $this->getAttributeValueFromFilterItem($item);
Method getOriginalUrl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getOriginalUrl(MagentoHttpRequest $request) : string
{
if ($originalUrl = $request->getQuery('__tw_original_url')) {
$urlArray = explode('/', $originalUrl);
$newOriginalUrl = '';
Function _ajaxHandler
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_ajaxHandler: function (event) {
event.preventDefault();
if (this.currentXhr) {
this.currentXhr.abort();
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
UrlInterface $url,
CurrentContext $currentNavigationContext,
ProductMetadataInterface $productMetadata,
FilterFormInputProviderInterface $filterFormInputProvider,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
CookieManagerInterface $cookieManager,
DataProviderHelper $dataProviderHelper,
SuggestionGroupItemFactory $suggestionGroupItemFactory,
RequestFactory $productSuggestionRequestFactory,
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
QueryFactory $queryFactory,
StoreManagerInterface $storeManager,
CategoryRepositoryInterface $categoryRepository,
HttpRequest $request,
Function getCollection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getCollection(Category $category)
{
if (!$this->config->isLayeredEnabled()) {
if (!$this->config->isSearchEnabled() || !($this->navigationContext->getRequest() instanceof ProductSearchRequest)) {
return $this->originalProvider->getCollection($category);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute(Observer $observer)
{
if (!$this->config->isSearchEnabled()) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"