ShopSearchAjax   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 1
cbo 2
dl 0
loc 21
ccs 0
cts 11
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateSearchResultsResponse() 0 12 4
1
<?php
2
/**
3
 * Pending some changes introduced to the core shop module, this will supply
4
 * some standard, easily overridable ajax features.
5
 *
6
 * @author Mark Guinn <[email protected]>
7
 * @date 07.21.2014
8
 * @package shop_search
9
 */
10
class ShopSearchAjax extends Extension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
{
12
    /**
13
     * @param SS_HTTPRequest $request
14
     * @param SS_HTTPResponse $response
15
     * @param ArrayData $results
16
     * @param array $data
17
     */
18
    public function updateSearchResultsResponse(&$request, &$response, $results, $data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20
        if ($request->isAjax() && $this->owner->hasExtension('AjaxControllerExtension')) {
21
            if (!$response) {
22
                $response = $this->owner->getAjaxResponse();
23
            }
24
            $response->addRenderContext('RESULTS', $results);
25
            $response->pushRegion('SearchResults', $results);
26
            $response->pushRegion('SearchHeader', $results);
27
            $response->triggerEvent('searchresults');
28
        }
29
    }
30
}
31