28. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-07-12 04:42:37 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

28.1 Files compared

#LocationFileLast Modified
1Porto v4.0.5/Theme Files/Porto Theme/app/code/Mageplaza/LayeredNavigation/Model/SearchFilterGroupBuilder.php2022-04-22 07:34:10 +0000
22023-07-12 04:42:37 +0000

28.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted00
Removed1137

28.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

28.4 Active regular expressions

No regular expressions were active.

28.5 Comparison detail

1 <?php    
2 /**    
3  * Mageplaza    
4  *    
5  * NOTICE OF LICENSE    
6  *    
7  * This source file is subject to the Mageplaza.com license that is    
8  * available through the world-wide-web at this URL:    
9  * https://www.mageplaza.com/LICENSE.txt    
10  *    
11  * DISCLAIMER    
12  *    
13  * Do not edit or add to this file if you wish to upgrade this extension to newer    
14  * version in the future.    
15  *    
16  * @category    Mageplaza    
17  * @package     Mageplaza_LayeredNavigation    
18  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)    
19  * @license     https://www.mageplaza.com/LICENSE.txt    
20  */    
21     
22 namespace Mageplaza\LayeredNavigation\Model\Search;    
23     
24 use Magento\Framework\Api\FilterBuilder;    
25 use Magento\Framework\Api\ObjectFactory;    
26 use Magento\Framework\Api\Search\FilterGroup;    
27 use Magento\Framework\Api\Search\FilterGroupBuilder as SourceFilterGroupBuilder;    
28 use Magento\Framework\App\RequestInterface;    
29 use Magento\Store\Model\StoreManagerInterface;    
30     
31 /**    
32  * Builder for FilterGroup Data.    
33  */    
34 class FilterGroupBuilder extends SourceFilterGroupBuilder    
35 {    
36     /** @var RequestInterface */    
37     protected $_request;    
38     /**    
39      * @var StoreManagerInterface    
40      */    
41     protected $storeManager;    
42     
43     /**    
44      * FilterGroupBuilder constructor.    
45      *    
46      * @param ObjectFactory $objectFactory    
47      * @param FilterBuilder $filterBuilder    
48      * @param RequestInterface $request    
49      * @param StoreManagerInterface $storeManager    
50      */    
51     public function __construct(    
52         ObjectFactory $objectFactory,    
53         FilterBuilder $filterBuilder,    
54         RequestInterface $request,    
55         StoreManagerInterface $storeManager    
56     ) {    
57         $this->_request = $request;    
58         $this->storeManager = $storeManager;    
59     
60         parent::__construct($objectFactory, $filterBuilder);    
61     }    
62     
63     /**    
64      * @return FilterGroupBuilder    
65      */    
66     public function cloneObject()    
67     {    
68         $cloneObject = clone $this;    
69         $cloneObject->setFilterBuilder(clone $this->_filterBuilder);    
70     
71         return $cloneObject;    
72     }    
73     
74     /**    
75      * @param $filterBuilder    
76      */    
77     public function setFilterBuilder($filterBuilder)    
78     {    
79         $this->_filterBuilder = $filterBuilder;    
80     }    
81     
82     /**    
83      * @param $attributeCode    
84      * @return $this    
85      * @throws \Magento\Framework\Exception\NoSuchEntityException    
86      */    
87     public function removeFilter($attributeCode)    
88     {    
89         if (isset($this->data[FilterGroup::FILTERS]) && is_array($this->data[FilterGroup::FILTERS])) {    
90             $count = 0;    
91             foreach ($this->data[FilterGroup::FILTERS] as $key => $filter) {    
92                 if ($filter->getField() === $attributeCode) {    
93                     if ($attributeCode === 'category_ids'    
94                         && (($filter->getValue() === $this->_request->getParam('id') && !$count)    
95                             || $filter->getValue() === $this->storeManager->getStore()->getRootCategoryId()    
96                         )    
97                     ) {    
98                         $count++;    
99                         continue;    
100                     }    
101                     unset($this->data[FilterGroup::FILTERS][$key]);    
102                 }    
103             }    
104         }    
105     
106         return $this;    
107     }    
108     
109     /**    
110      * @param $categoryIds    
111      *    
112      * @return $this    
113      */    
114     public function setCategoryFilter($categoryIds)    
115     {    
116         if (isset($this->data[FilterGroup::FILTERS]) && is_array($this->data[FilterGroup::FILTERS])) {    
117             foreach ($this->data[FilterGroup::FILTERS] as $key => $filter) {    
118                 if ($filter->getField() === 'category_ids') {    
119                     $filter->setValue($categoryIds);    
120                     return $this;    
121                 }    
122             }    
123         }    
124     
125         return $this;    
126     }    
127     
128     /**    
129      * Return the Data type class name    
130      *    
131      * @return string    
132      */    
133     protected function _getDataObjectType()    
134     {    
135         return FilterGroup::class;    
136     }    
137 }