Parse a QUOTA response (RFC 2087 [5.1]).

@param Horde_Imap_Client_Interaction_Pipeline $pipeline  Pipeline
object.
@param Horde_Imap_Client_Tokenize $data  The server response.
6578
protected function _parseQuota(
        Horde_Imap_Client_Interaction_Pipeline $pipeline,
        Horde_Imap_Client_Tokenize $data
    )
    {
        $c = &$pipeline->data['quotaresp'];

        $root = $data->next();
        $c[$root] = array();

        $data->next();

        while (($curr = $data->next()) !== false) {
            $c[$root][Horde_String::lower($curr)] = array(
                'usage' => $data->next(),
                'limit' => $data->next()
            );
        }
    }
1026011
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $limitation = $this->getLimitationByIdentifier($data['_identifier']);

        $limitationValues = array();
        foreach ($data['values']['ref'] as $limitationValue) {
            $limitationValues[] = $limitationValue['_href'];
        }

        $limitation->limitationValues = $limitationValues;

        return $limitation;
    }
272060
public function parseChunk($data)
    {
        if (!$data) {
            return;
        }
        // Detect end of transfer
        if ($end = strpos($data, "0\r\n\r\n")) {
            $data = substr($data, 0, $end);
        }
        $this->buffer.= $data;
        $this->request->onData($data);

        if ($end) {
            $this->buffer = $this->parseChunkedBuffer($this->buffer);
            $this->request->setBody($this->buffer);
            $this->notifyCompleted();
            $this->buffer = '';
        }
    }
393595
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $roles = array();
        foreach ($data['Role'] as $rawRoleData) {
            $roles[] = $parsingDispatcher->parse(
                $rawRoleData,
                $rawRoleData['_media-type']
            );
        }

        return $roles;
    }
68609
public function aggregate(array $pipeline, array $options = [])
    {
        if (array_key_exists('pipeline', $options)) {
            throw new InvalidArgumentException('Option "pipeline" is not allowed, use $pipeline argument.');
        }

        return $this->executeCommand(
            ['aggregate' => $this->collectionName],
            ['pipeline' => $pipeline] + $options
        );
    }
1160976
public function merge(Horde_Imap_Client_Data_Fetch $data)
    {
        $this->_data = array_replace_recursive(
            $this->_data,
            $data->getRawData()
        );
    }
965487
protected function _serverResponse(
        Horde_Imap_Client_Interaction_Pipeline $pipeline,
        Horde_Imap_Client_Interaction_Server $ob
    )
    {
        $token = $ob->token;

        /* First, catch untagged responses where the name appears first on the
         * line. */
        switch ($first = Horde_String::upper($token->current())) {
        case 'CAPABILITY':
            $this->_parseCapability($pipeline, $token->flushIterator());
            break;

        case 'LIST':
        case 'LSUB':
            $this->_parseList($pipeline, $token);
            break;

        case 'STATUS':
            // Parse a STATUS response (RFC 3501 [7.2.4]).
            $this->_parseStatus($token);
            break;

        case 'SEARCH':
        case 'SORT':
            // Parse a SEARCH/SORT response (RFC 3501 [7.2.5] & RFC 5256 [4]).
            $this->_parseSearch($pipeline, $token->flushIterator());
            break;

        case 'ESEARCH':
            // Parse an ESEARCH response (RFC 4466 [2.6.2]).
            $this->_parseEsearch($pipeline, $token);
            break;

        case 'FLAGS':
            $token->next();
            $this->_mailboxOb()->setStatus(Horde_Imap_Client::STATUS_FLAGS, array_map('Horde_String::lower', $token->flushIterator()));
            break;

        case 'QUOTA':
            $this->_parseQuota($pipeline, $token);
            break;

        case 'QUOTAROOT':
            // Ignore this line - we can get this information from
            // the untagged QUOTA responses.
            break;

        case 'NAMESPACE':
            $this->_parseNamespace($pipeline, $token);
            break;

        case 'THREAD':
            $this->_parseThread($pipeline, $token);
            break;

        case 'ACL':
            $this->_parseACL($pipeline, $token);
            break;

        case 'LISTRIGHTS':
            $this->_parseListRights($pipeline, $token);
            break;

        case 'MYRIGHTS':
            $this->_parseMyRights($pipeline, $token);
            break;

        case 'ID':
            // ID extension (RFC 2971)
            $this->_parseID($pipeline, $token);
            break;

        case 'ENABLED':
            // ENABLE extension (RFC 5161)
            $this->_parseEnabled($token);
            break;

        case 'LANGUAGE':
            // LANGUAGE extension (RFC 5255 [3.2])
            $this->_parseLanguage($token);
            break;

        case 'COMPARATOR':
            // I18NLEVEL=2 extension (RFC 5255 [4.7])
            $this->_parseComparator($pipeline, $token);
            break;

        case 'VANISHED':
            // QRESYNC extension (RFC 7162 [3.2.10])
            $this->_parseVanished($pipeline, $token);
            break;

        case 'ANNOTATION':
            // Parse an ANNOTATION response.
            $this->_parseAnnotation($pipeline, $token);
            break;

        case 'METADATA':
            // Parse a METADATA response.
            $this->_parseMetadata($pipeline, $token);
            break;

        default:
            // Next, look for responses where the keywords occur second.
            switch (Horde_String::upper($token->next())) {
            case 'EXISTS':
                // EXISTS response - RFC 3501 [7.3.2]
                $mbox_ob = $this->_mailboxOb();

                // Increment UIDNEXT if it is set.
                if ($mbox_ob->open &&
                    ($uidnext = $mbox_ob->getStatus(Horde_Imap_Client::STATUS_UIDNEXT))) {
                    $mbox_ob->setStatus(Horde_Imap_Client::STATUS_UIDNEXT, $uidnext + $first - $mbox_ob->getStatus(Horde_Imap_Client::STATUS_MESSAGES));
                }

                $mbox_ob->setStatus(Horde_Imap_Client::STATUS_MESSAGES, $first);
                break;

            case 'RECENT':
                // RECENT response - RFC 3501 [7.3.1]
                $this->_mailboxOb()->setStatus(Horde_Imap_Client::STATUS_RECENT, $first);
                break;

            case 'EXPUNGE':
                // EXPUNGE response - RFC 3501 [7.4.1]
                $this->_deleteMsgs($this->_selected, $this->getIdsOb($first, true), array(
                    'decrement' => true,
                    'pipeline' => $pipeline
                ));
                $pipeline->data['expunge_seen'] = true;
                break;

            case 'FETCH':
                // FETCH response - RFC 3501 [7.4.2]
                $this->_parseFetch($pipeline, $first, $token);
                break;
            }
            break;
        }
    }
791335
public function commandParseResponse(GuzzleCreateResponseClassEvent $event)
    {
        /** @var GuzzleCommandInterface $command */
        $command = $event['command'];

        $className = $this->getClassName($command);

        // if the guzzle way fromCommand is present don't do anything
        if (!method_exists($className, 'fromCommand')) {
            $event->setResult(
                $this->serializer->deserialize($command->getResponse()->getBody(), $className, 'json')
            );
        }
    }
1040611
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $contentTypeGroupReferences = array();
        foreach ($data['ContentTypeGroupRef'] as $groupData) {
            $contentTypeGroupReferences[] = $groupData['_href'];
        }

        return new Values\ContentTypeGroupRefList(
            $this->contentTypeService,
            $data['_href'],
            $contentTypeGroupReferences
        );
    }
1109799
protected function _sendCmdChunk($pipeline, $chunk)
    {
        if (empty($chunk)) {
            return;
        }

        $cmd_count = count($chunk);
        $exception = null;

        foreach ($chunk as $val) {
            $val->pipeline = $pipeline;

            try {
                if ($this->_processCmd($pipeline, $val, $val)) {
                    $this->_connection->write('', true);
                } else {
                    $cmd_count = 0;
                }
            } catch (Horde_Imap_Client_Exception $e) {
                switch ($e->getCode()) {
                case Horde_Imap_Client_Exception::SERVER_WRITEERROR:
                    $this->_temp['logout'] = true;
                    $this->logout();
                    break;
                }

                throw $e;
            }
        }

        while ($cmd_count) {
            try {
                if ($this->_getLine($pipeline) instanceof Horde_Imap_Client_Interaction_Server_Tagged) {
                    --$cmd_count;
                }
            } catch (Horde_Imap_Client_Exception $e) {
                switch ($e->getCode()) {
                case $e::DISCONNECT:
                    /* Guaranteed to have no more data incoming, so we can
                     * immediately logout. */
                    $this->_temp['logout'] = true;
                    $this->logout();
                    throw $e;
                }

                /* For all other issues, catch and store exception; don't
                 * throw until all input is read since we need to clear
                 * incoming queue. (For now, only store first exception.) */
                if (is_null($exception)) {
                    $exception = $e;
                }

                if (($e instanceof Horde_Imap_Client_Exception_ServerResponse) &&
                    $e->command) {
                    --$cmd_count;
                }
            }
        }

        if (!is_null($exception)) {
            throw $exception;
        }
    }
1198947
function parse($data)
    {
        $_header = strstr($data, self::HTTP_EOF, true);
        if ($_header === false)
        {
            $this->buffer = $data;
        }
        $header = self::parseHeader($_header);
        if ($header === false)
        {
            $this->isError = true;
        }
        $this->header = $header;
        return $header;
    }
800439
public function register(array $data): PodiumResponse
    {
        $registration = $this->getRegisterer();

        if (!$registration->loadData($data)) {
            return PodiumResponse::error();
        }

        return $registration->register();
    }
985754
public function getAuthorizationResponse($data)
    {
        $this->makePaymentRequest($data);

        $this->url = $this->getResponse()['data']['authorization_url'];

        return $this->getResponse();
    }
136072
protected function runSynchronously(Pipeline $pipeline)
    {
        $results = [];

        /** @var Closure $task */
        foreach ($pipeline as $key => $task) {
            $results[$key] = $this->bash->checkResults($task());
            if (!$results[$key]) {
                break;
            }
        }

        // Update Pipeline results
        $pipeline->setResults($results);

        return $pipeline;
    }
729138
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $policyUpdate = $this->roleService->newPolicyUpdateStruct();

        // @todo XSD says that limitations field is mandatory, but
        // it needs to be possible to remove limitations from policy
        if (array_key_exists('limitations', $data)) {
            if (!is_array($data['limitations'])) {
                throw new Exceptions\Parser("Invalid format for 'limitations' in PolicyUpdate.");
            }

            if (!isset($data['limitations']['limitation']) || !is_array($data['limitations']['limitation'])) {
                throw new Exceptions\Parser("Invalid format for 'limitations' in PolicyUpdate.");
            }

            foreach ($data['limitations']['limitation'] as $limitationData) {
                $policyUpdate->addLimitation(
                    $this->parserTools->parseLimitation($limitationData)
                );
            }
        }

        return $policyUpdate;
    }
469477
def parse_skypipe_data_stream(msg, for_pipe):
    """"""
    header = str(msg.pop(0))
    command = str(msg.pop(0))
    pipe_name = str(msg.pop(0))
    data = str(msg.pop(0))
    if header != SP_HEADER: return
    if pipe_name != for_pipe: return
    if command != SP_CMD_DATA: return
    if data == SP_DATA_EOF:
        raise EOFError()
    else:
        return data
969772
public function pipe(CommandMessage $message): void
    {
        /** @var CommandFilter $filter */
        $filter = $this->stack->pop();
        $filter->process($message, [$this, 'pipe']);
    }