Parses POST data into array of JSON-PRC batch requests
@return array
@throws \yii\web\BadRequestHttpException
12737
protected function getRequestArray()
    {
        $requestArray = Yii::$app->request->getBodyParams();
        if (!is_array($requestArray)) {
            throw new \yii\web\BadRequestHttpException('Invalid JSON-RPC request.');
        }

        if (!ArrayHelper::isIndexed($requestArray)) {
            $requestArray = array($requestArray);
        }

        return $requestArray;
    }
1369239
protected function getRequestData()
    {
        if (Yii::$app->request->method === 'POST') {
            return $this->getRealPOSTData();
        }
        if (Yii::$app->request->method === 'GET') {
            $requestData = Yii::$app->request->get();
            unset($requestData['action']); // delete service GET param
            return $requestData;
        }

        throw new BadRequestHttpException('Unsupported request method.');
    }
931449
protected function getContentAsArray(Request $request)
    {
        $content = json_decode($request->getContent(), true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new BadRequestException();
        }

        if ($content === null) {
            return [];
        }

        return $content;
    }
133616
public function getData()
    {
        $result = [
            'type' => $this->type
        ];

        switch($this->type)
        {
            case self::TYPE_POSTBACK:
                $result['title'] = $this->title;
                $result['payload'] = $this->url;
            break;

            case self::TYPE_CALL:
                $result['title'] = $this->title;
                $result['payload'] = $this->url;
            break;

            case self::TYPE_WEB:
              $result['title'] = $this->title;
              $result['url'] = $this->url;

              if ($this->webview_height_ratio) {
                  $result['webview_height_ratio'] = $this->webview_height_ratio;
              }

              if ($this->messenger_extensions){
                  $result['messenger_extensions'] = $this->messenger_extensions;
                  $result['fallback_url'] = $this->fallback_url;
              }
              
              if($this->webview_share_button){
                  $result['webview_share_button'] = $this->webview_share_button ;
              }
            break;

            case self::TYPE_SHARE:
              //only share_contents needed
               if ($this->share_contents)
                $result['share_contents'] = $this->share_contents->getData();
            break;

            case self::TYPE_ACCOUNT_LINK:
                $result['url'] = $this->url;
            break;

            case self::TYPE_ACCOUNT_UNLINK:
              //only type needed
            break;

        }

        return $result;
    }
1344417
protected function pullPost() {
		if (!is_array($this->postVars)) {
			$this->postVars = $this->request->getParsedBody();
			
			if (!is_array($this->postVars)) {
				$this->postVars = [];
			}
		}
		
		return $this->postVars;
	}
850498
protected function _getJsonRpcRequest() {
        if ($this->getRequest()->getPost('request')) {
            return $this->getRequest()->getPost('request');
        }
        return $request = $this->getRequest()->getRawBody();
    }
371748
protected function getInput()
    {
        $type = $this->request->headers->get('CONTENT_TYPE');

        // If it's json, decode it
        if (stripos($type, '/json') !== false || stripos($type, '+json') !== false) {
            if (is_array($parsed = json_decode($this->request->getContent(), true))) {
                return $parsed;
            }
        }

        // Yes, we really do want request->request
        return $this->request->request->all();
    }
1098956
public function jsonSerialize()
    {
        ob_start();
        echo $this->renderSearchField();
        $field = ob_get_contents();
        ob_end_clean();

        $ag = ResponseAssetGroup::get();
        $assetsResponse = [];
        foreach ($ag->getAssetsToOutput() as $position => $assets) {
            foreach ($assets as $asset) {
                if (is_object($asset)) {
                    $assetsResponse[$asset->getAssetType()][] = $asset->getAssetURL();
                }
            }
        }

        return [
            'key' => $this->getKey(),
            'label' => $this->getDisplayName(),
            'element' => $field,
            'data' => $this->data,
            'assets' => $assetsResponse,
        ];
    }
866401
public function toArray()
    {
        return [
            'uuid' => $this->uuid,
            'batch_id' => $this->batchId,
            'type' => $this->type,
            'content' => $this->content,
            'created_at' => $this->recordedAt->toDateTimeString(),
        ];
    }
453468
public function toArray(): array
    {
        return  [
            'countryCode' => $this->getCountryCode(),
            'vatNumber'   => $this->getVatNumber(),
            'requestDate' => $this->getRequestDate()->format('Y-m-d'),
            'valid'       => $this->isValid(),
            'name'        => $this->getName(),
            'address'     => $this->getAddress(),
            'identifier'  => $this->getIdentifier(),
            'nameMatch'   => $this->getNameMatch(),
            'companyTypeMatch' => $this->getCompanyTypeMatch(),
            'streetMatch' => $this->getStreetMatch(),
            'postcodeMatch' => $this->getPostcodeMatch(),
            'cityMatch' => $this->getCityMatch(),
        ];
    }
222066
public function parse(Request $request): array
    {
        // Extracts the GraphQL request parameters
        $queries = $this->getParsedBody($request);

        if (empty($queries)) {
            throw new BadRequestHttpException('Must provide at least one valid query.');
        }

        foreach ($queries as $i => &$query) {
            $query = \array_filter($query) + self::$queriesDefaultValue;

            if (!\is_string($query[static::PARAM_QUERY])) {
                throw new BadRequestHttpException(\sprintf('%s is not a valid query', \json_encode($query[static::PARAM_QUERY])));
            }
        }

        return $queries;
    }
967134
public function getTranslatedData()
    {
        if(!$this->isXmlHttpRequest()){
            throw new common_exception_BadRequest('wrong request mode');
        }
        $data = array();
        if($this->hasRequestParameter('lang')){
            $data = tao_helpers_Uri::encodeArray(
                $this->getClassService()->getTranslatedProperties(
                    $this->getCurrentInstance(),
                    $this->getRequestParameter('lang')
                ),
                tao_helpers_Uri::ENCODE_ARRAY_KEYS);
        }
        $this->returnJson($data);
    }
891925
public function getData() : array
    {
        $data = [];

        if ($this->getRequest()->getMethod() == Request::METHOD_POST) {
            $data = $_POST ?: [];
        }

        return $data;
    }
1374225
public function toArray()
    {
        return array_filter(
            array(
                'method' => $this->getMethod(),
                'url' => $this->getUrl(),
                'headers' => $this->getHeaders(),
                'body' => $this->getBody(),
                'post_files' => $this->getPostFiles(),
                'post_fields' => $this->getPostFields(),
            )
        );
    }
679664
public function getArray()
    {
        $arr = array('jsonrpc' => self::JSON_RPC_VERSION, 'method' => $this->method);
        if ($this->params) {
            $arr['params'] = $this->params;
        }
        if ($this->id !== null) {
            $arr['id'] = $this->id;
        }
        return $arr;
    }
1307735
public function getJson()
    {
        $body = $this->getBody();
        $json = json_decode($body, true);

        if (!is_array($json)) {
            if ($this->_wasAsync) {
                return [];
            }

            // should be an array, fail otherwise
            throw new ClientException('Got a malformed result from the server');
        }

        return $json;
    }
660217
public function getHeaderArray()
    {
        $headerArray = (count($this->headers) > 0 ? $this->headers : []);
        if ($this->isJson) {
            $headerArray[] = 'Accept: application/json';
        }
        if ($this->isXML) {
            $headerArray[] = 'Accept: text/xml';
        }
        if ($this->method == 'POST' && count($this->data) > 0 && $this->isJson) {
            $headerArray[] = 'Content-type: application/json';
        } elseif ($this->method == 'POST' && count($this->data) > 0 && $this->isXML) {
            $headerArray[] = 'Content-type: text/xml';
        } elseif ($this->method == 'POST' && count($this->data) > 0) {
            $headerArray[] = 'Content-type: application/x-www-form-urlencoded';
        }
        if (count($this->cookies) > 0) {
            $cookies = '';
            foreach ($this->cookies as $key => $value) {
                if (mb_strlen($cookies) > 0) {
                    $cookies .= '; ';
                }
                $cookies .= urlencode($key) . '=' . urlencode($value);
            }
            $headerArray[] = 'Cookie: ' . $cookies;
        }

        return $headerArray;
    }