ShopSearchAjax::updateSearchResultsResponse()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.2
cc 4
eloc 8
nc 3
nop 4
crap 20
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