src/Controller/DefaultController.php
public function getSearch($aData = [])
    {
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');
        $oItemModel = Factory::model(
            static::CONFIG_MODEL_NAME,
            static::CONFIG_MODEL_PROVIDER
        );
        $sKeywords  = $oInput->get('search') ?: $oInput->get('keywords');
        $iPage      = (int) $oInput->get('page');

        if (strlen($sKeywords) < static::CONFIG_MIN_SEARCH_LENGTH) {
            throw new ApiException(
                'Search term must be ' . static::CONFIG_MIN_SEARCH_LENGTH . ' characters or longer.',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oResult = $oItemModel->search(
            $sKeywords,
            $iPage,
            static::CONFIG_MAX_ITEMS_PER_PAGE,
            $aData
        );

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData(array_map([$this, 'formatObject'], $oResult->data));
        return $oResponse;
    }
public function getSearch($aData = [])
    {
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');
        $oItemModel = Factory::model(
            static::CONFIG_MODEL_NAME,
            static::CONFIG_MODEL_PROVIDER
        );
        $sKeywords  = $oInput->get('search') ?: $oInput->get('keywords');
        $iPage      = (int) $oInput->get('page');

        if (strlen($sKeywords) < static::CONFIG_MIN_SEARCH_LENGTH) {
            throw new ApiException(
                'Search term must be ' . static::CONFIG_MIN_SEARCH_LENGTH . ' characters or longer.',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oResult = $oItemModel->search(
            $sKeywords,
            $iPage,
            static::CONFIG_MAX_ITEMS_PER_PAGE,
            $aData
        );

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData(array_map([$this, 'formatObject'], $oResult->data));
        return $oResponse;
    }
Search for an item

@param array $aData The configuration array

@return array