Showing 132 of 165 total issues
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
Function createFilterSlugByAttributeOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function createFilterSlugByAttributeOptions(array $options)
{
foreach ($options as $option) {
if (empty($option->getLabel()) || ctype_space((string) $option->getLabel())) {
continue;
- 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 buildFilterUrl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function buildFilterUrl(MagentoHttpRequest $request, array $filters = []): string
{
$currentUrl = $this->getOriginalUrl($request);
$currentFilterPath = $request->getParam(self::REQUEST_FILTER_PATH);
- 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 getOriginalUrl
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getOriginalUrl(MagentoHttpRequest $request): string
{
$originalUrl = $request->getQuery('__tw_original_url');
if ($originalUrl) {
$urlArray = explode('/', $originalUrl);
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 save
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save(AttributeSlugInterface $attributeSlug): AttributeSlugInterface
{
try {
//check for existing slugs with the same slug
try {
Method getShoppingcartCrosssellItems
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getShoppingcartCrosssellItems(array $cartProductIds, array $result)
{
$items = [];
if ($cartProductIds) {
Method getShoppingcartCrosssellItems
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getShoppingcartCrosssellItems(array $cartProductIds, array $result)
{
$items = [];
if ($cartProductIds) {
Function _handleFilterSearch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleFilterSearch: function () {
var filterInput = this.element.find('.tw_filtersearch');
var value = filterInput.val().toLowerCase().trim();
var items = filterInput.parent('div').find('ol');
var noItems = filterInput.parent('div').find('.search_no_results');
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,
Function getSwatchMap
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function getSwatchMap(): array
{
if ($this->swatchMap !== null) {
return $this->swatchMap;
}
- 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 aroundRender
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function aroundRender(FilterRenderer $subject, Closure $proceed, FilterInterface $filter)
{
if (!$filter instanceof Filter) {
return $proceed($filter);
}
- 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"
Further reading
Function addParameter
has a Cognitive Complexity of 9 (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 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() ||
- 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 getItems
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getItems()
{
$query = $this->dataProviderHelper->getQuery();
if (empty($query)) {
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"
Further reading
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
Registry $registry,
Context $context,
TemplateFinder $templateFinder,
Session $checkoutSession,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
UrlStrategyFactory $urlStrategyFactory,
UrlInterface $url,
CategoryRepository $categoryRepository,
StoreManagerInterface $storeManager,
Helper $exportHelper,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
UrlModel $url,
StrategyHelper $strategyHelper,
CookieManagerInterface $cookieManager,
TweakwiseConfig $config,
Url $layerUrl,