public function iSendARequest($method, TableNode $params)
    {
        $id = $this->getRequestId() ? $this->getRequestId() : uniqid();

        $params = $params->getRowsHash();
        $requestParameters = [];

        foreach ($params as $parameterKey => $parameterValue) {
            $property = new PropertyPath($parameterKey);
            $propertyElements = $property->getElements();

            $activeKeyReference = &$requestParameters;

            while (null !== $propertyElement = array_shift($propertyElements)) {
                if (!isset($activeKeyReference[$propertyElement])) {
                    $activeKeyReference[$propertyElement] = []; // Force set array value
                }

                $activeKeyReference = &$activeKeyReference[$propertyElement];
            }

            if (preg_match('/^@\[([^\]]+)?\]$/', trim($parameterValue), $parts)) {
                if (!empty($parts[1])) {
                    $elements = explode(',', $parts[1]);
                    $elements = array_map('trim', $elements);
                } else {
                    // Empty string
                    $elements = [];
                }

                $parameterValue = $elements;
            }

            $activeKeyReference = $parameterValue;
        }

        /** @var \Graze\GuzzleHttp\JsonRpc\Message\RequestInterface $request */
        $request = $this->client->request($id, $method, $requestParameters);

        foreach ($this->headers as $headerName => $headerValue) {
            $request = $request->withHeader($headerName, $headerValue);
        }

        $uri = $request->getUri();
        $uri = $uri->withPath($uri->getPath() . $this->path);
        $request = $request->withUri($uri);

        $this->request = $request;

        $this->sendRequest();
    }
public function iSendARequest($method, TableNode $params)
    {
        $id = $this->getRequestId() ? $this->getRequestId() : uniqid();

        $params = $params->getRowsHash();
        $requestParameters = [];

        foreach ($params as $parameterKey => $parameterValue) {
            $property = new PropertyPath($parameterKey);
            $propertyElements = $property->getElements();

            $activeKeyReference = &$requestParameters;

            while (null !== $propertyElement = array_shift($propertyElements)) {
                if (!isset($activeKeyReference[$propertyElement])) {
                    $activeKeyReference[$propertyElement] = []; // Force set array value
                }

                $activeKeyReference = &$activeKeyReference[$propertyElement];
            }

            if (preg_match('/^@\[([^\]]+)?\]$/', trim($parameterValue), $parts)) {
                if (!empty($parts[1])) {
                    $elements = explode(',', $parts[1]);
                    $elements = array_map('trim', $elements);
                } else {
                    // Empty string
                    $elements = [];
                }

                $parameterValue = $elements;
            }

            $activeKeyReference = $parameterValue;
        }

        /** @var \Graze\GuzzleHttp\JsonRpc\Message\RequestInterface $request */
        $request = $this->client->request($id, $method, $requestParameters);

        foreach ($this->headers as $headerName => $headerValue) {
            $request = $request->withHeader($headerName, $headerValue);
        }

        $uri = $request->getUri();
        $uri = $uri->withPath($uri->getPath() . $this->path);
        $request = $request->withUri($uri);

        $this->request = $request;

        $this->sendRequest();
    }
public function iSendARequest ( $ method , TableNode $ params ) { $ id = $ this -> getRequestId ( ) ? $ this -> getRequestId ( ) : uniqid ( ) ; $ params = $ params -> getRowsHash ( ) ; $ requestParameters = [ ] ; foreach ( $ params as $ parameterKey => $ parameterValue ) { $ property = new PropertyPath ( $ parameterKey ) ; $ propertyElements = $ property -> getElements ( ) ; $ activeKeyReference = & $ requestParameters ; while ( null !== $ propertyElement = array_shift ( $ propertyElements ) ) { if ( ! isset ( $ activeKeyReference [ $ propertyElement ] ) ) { $ activeKeyReference [ $ propertyElement ] = [ ] ; // Force set array value } $ activeKeyReference = & $ activeKeyReference [ $ propertyElement ] ; } if ( preg_match ( '/^@\[([^\]]+)?\]$/' , trim ( $ parameterValue ) , $ parts ) ) { if ( ! empty ( $ parts [ 1 ] ) ) { $ elements = explode ( ',' , $ parts [ 1 ] ) ; $ elements = array_map ( 'trim' , $ elements ) ; } else { // Empty string $ elements = [ ] ; } $ parameterValue = $ elements ; } $ activeKeyReference = $ parameterValue ; } /** @var \Graze\GuzzleHttp\JsonRpc\Message\RequestInterface $request */ $ request = $ this -> client -> request ( $ id , $ method , $ requestParameters ) ; foreach ( $ this -> headers as $ headerName => $ headerValue ) { $ request = $ request -> withHeader ( $ headerName , $ headerValue ) ; } $ uri = $ request -> getUri ( ) ; $ uri = $ uri -> withPath ( $ uri -> getPath ( ) . $ this -> path ) ; $ request = $ request -> withUri ( $ uri ) ; $ this -> request = $ request ; $ this -> sendRequest ( ) ; }
Sends Json rpc request to specific method.

@param string    $method request method
@param TableNode $params table of params values

@When /^(?:I )?send a request to "([^"]+)" with params:$/
Sends Json rpc request to specific method .