Showing 132 of 165 total issues
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
UrlInterface $url,
Registry $registry,
Config $config,
StoreManagerInterface $storeManager,
CategoryRepositoryInterface $categoryRepository,
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 forProduct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function forProduct(Product $product, $type)
{
$attribute = $this->getAttribute($type);
$templateId = (int) $product->getData($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 __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
RequestFactory $requestFactory,
Client $client,
Url $url,
FilterableAttributeListInterface $filterableAttributes,
Function getOriginalUrl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getOriginalUrl(MagentoHttpRequest $request): string
{
$twOriginalUrl = $request->getParam('__tw_original_url');
if ($twOriginalUrl) {
// This seems ugly, perhaps there is another way?
- 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 getCollection
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCollection(Category $category)
{
if (!$this->config->isLayeredEnabled()) {
if (
!$this->config->isSearchEnabled() ||
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 getProductItems
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProductItems(AutocompleteProductResponseInterface $response)
{
$productCollection = $this->productCollectionFactory->create();
$productCollection->setStore($this->storeManager->getStore());
$productCollection->addAttributeToFilter('entity_id', ['in' => $response->getProductIds()]);
Method ensureCrosssellTemplateAttribute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureCrosssellTemplateAttribute(EavSetup $eavSetup)
{
foreach ([Category::ENTITY, Product::ENTITY] as $entityType) {
$eavSetup->addAttribute(
$entityType,
Function _ajaxHandler
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_ajaxHandler: function (event) {
event.preventDefault();
if(event.target.name == 'tw_filtersearch') {
return;
Method ensureUpsellTemplateAttribute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureUpsellTemplateAttribute(EavSetup $eavSetup)
{
foreach ([Category::ENTITY, Product::ENTITY] as $entityType) {
$eavSetup->addAttribute(
$entityType,
Method ensureUpsellTemplateAttribute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureUpsellTemplateAttribute(EavSetup $eavSetup)
{
foreach ([Category::ENTITY, Product::ENTITY] as $entityType) {
$eavSetup->addAttribute(
$entityType,
Method getSwatchMap
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getSwatchMap(): array
{
if ($this->swatchMap !== null) {
return $this->swatchMap;
}
Method ensureCrosssellTemplateAttribute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureCrosssellTemplateAttribute(EavSetup $eavSetup)
{
foreach ([Category::ENTITY, Product::ENTITY] as $entityType) {
$eavSetup->addAttribute(
$entityType,
Method ensureShoppingcartCrosssellTemplateAttribute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureShoppingcartCrosssellTemplateAttribute(EavSetup $eavSetup)
{
foreach ([Category::ENTITY, Product::ENTITY] as $entityType) {
$eavSetup->addAttribute(
$entityType,
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 __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
QueryFactory $queryFactory,
StoreManagerInterface $storeManager,
CategoryRepositoryInterface $categoryRepository,
HttpRequest $request,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
DataProviderHelper $dataProviderHelper,
Config $config,
Client $client,
RequestFactory $autocompleteRequestFactory,
StoreManagerInterface $storeManager,
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"