@param BufferInterface $buffer

@return array
483002
public function match(BufferInterface $buffer)
    {
        if ($this->tokenStore->hasChanged($this->tokenMask)) {
            $this->parseTokens();
        }

        $contents = $buffer->getContents();
        $length = $buffer->getLength();
        $position = $buffer->getPosition();
        if (count($this->tokens) > 0) {
            $totalLen = max($length - $this->maxLen, 1);
            for ($i = 0; $i < $totalLen; $i++) {
                foreach ($this->keyLengths as $len) {
                    $buf = substr($contents, $i, $len);
                    if (isset($this->tokens[$buf])) {
                        if ($i > 0) {
                            return [
                                [Token::T_CONTENT, substr($contents, 0, $i), $position, $i],
                                [$this->tokens[$buf], $buf, $position + $i, $len],
                            ];
                        } else {
                            return [[$this->tokens[$buf], $buf, $position, $len]];
                        }
                    }
                }
                if ($totalLen !== $length && $i == $totalLen - 1) {
                    $buffer->read();
                    $totalLen = $length = $buffer->getLength();
                    $contents = $buffer->getContents();
                }
            }
        }

        return [[Token::T_CONTENT, $contents[0], $buffer->getPosition(), 1]];
    }
525867
public function parseValue($buffer, &$out)
    {
        $this->count           = 0;
        $this->env             = null;
        $this->inParens        = false;
        $this->eatWhiteDefault = true;
        $this->buffer          = (string) $buffer;

        $this->saveEncoding();

        $list = $this->valueList($out);

        $this->restoreEncoding();

        return $list;
    }
46317
protected function processInfo(Buffer $buffer)
    {
        // Set the result to a new result instance
        $result = new Result();

        $result->add('servername', $buffer->readString());
        $result->add('mapname', $buffer->readString());
        $result->add('modname', $buffer->readString());
        $result->add('gamemode', $buffer->readString());
        $result->add('description', $buffer->readString());
        $result->add('version', $buffer->readString());
        $result->add('port', $buffer->readInt16());
        $result->add('num_players', $buffer->readInt8());
        $result->add('max_players', $buffer->readInt8());
        $result->add('dedicated', $buffer->readInt8());
        $result->add('os', $buffer->readInt8());
        $result->add('password', $buffer->readInt8());
        $result->add('anticheat', $buffer->readInt8());
        $result->add('average_fps', $buffer->readInt8());
        $result->add('round', $buffer->readInt8());
        $result->add('max_rounds', $buffer->readInt8());
        $result->add('time_left', $buffer->readInt16());

        unset($buffer);

        return $result->fetch();
    }
252178
protected static function jsonParser(StreamInterface $stream): array
	{
		$json = \trim((string) $stream);
		if ($json === '') {
			return [];
		}

		$data = \json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
		if (\json_last_error() !== JSON_ERROR_NONE) {
			throw new \DomainException(\json_last_error_msg());
		}

		return ['body' => $data ?: []];
	}
1056650
private function getFieldCopyToProperties(FieldInterface $field)
    {
        $copyTo = [];

        foreach ($this->copyFieldMap as $method => $targetField) {
            if ($field->$method()) {
                $copyTo[] = $targetField;
            }
        }

        return $copyTo;
    }
1324126
protected function processStatus(Buffer $buffer)
    {
        // We need to split the data and offload
        $results = $this->processServerInfo(new Buffer($buffer->readString("\x0A")));

        $results = array_merge_recursive(
            $results,
            $this->processPlayers(new Buffer($buffer->getBuffer()))
        );

        unset($buffer);

        // Return results
        return $results;
    }
517891
public function getResourcePermissions(ResourceInterface $resource) : array
    {
        $query = $this->getRepository()->createQueryBuilder('r')
            ->select('r')
            ->where('r.resource_class = :resourceClass AND r.resource_id=:resourceId')
            ->setParameter('resourceClass', $resource->getClass())
            ->setParameter('resourceId', $resource->getId())
            ->getQuery();

        return $query->getResult();
    }
628133
public static function decode($buffer, ConnectionInterface $connection)
    {
        $masks = $data = $decoded = '';
        $len = ord($buffer[1]) & 127;
        if ($len === 126) {
            $masks = substr($buffer, 4, 4);
            $data  = substr($buffer, 8);
        } else {
            if ($len === 127) {
                $masks = substr($buffer, 10, 4);
                $data  = substr($buffer, 14);
            } else {
                $masks = substr($buffer, 2, 4);
                $data  = substr($buffer, 6);
            }
        }
        for ($index = 0; $index < strlen($data); $index++) {
            $decoded .= $data[$index] ^ $masks[$index % 4];
        }
        if ($connection->websocketCurrentFrameLength) {
            $connection->websocketDataBuffer .= $decoded;
            return $connection->websocketDataBuffer;
        } else {
            if ($connection->websocketDataBuffer !== '') {
                $decoded                         = $connection->websocketDataBuffer . $decoded;
                $connection->websocketDataBuffer = '';
            }
            return $decoded;
        }
    }
636464
public function consumeFieldValue(Buffer $buffer)
    {
        $fieldType = $buffer->consumeUint8();

        switch ($fieldType) {
            case Constants::FIELD_BOOLEAN:
                return $buffer->consumeUint8() > 0;
            case Constants::FIELD_SHORT_SHORT_INT:
                return $buffer->consumeInt8();
            case Constants::FIELD_SHORT_SHORT_UINT:
                return $buffer->consumeUint8();
            case Constants::FIELD_SHORT_INT:
                return $buffer->consumeInt16();
            case Constants::FIELD_SHORT_UINT:
                return $buffer->consumeUint16();
            case Constants::FIELD_LONG_INT:
                return $buffer->consumeInt32();
            case Constants::FIELD_LONG_UINT:
                return $buffer->consumeUint32();
            case Constants::FIELD_LONG_LONG_INT:
                return $buffer->consumeInt64();
            case Constants::FIELD_LONG_LONG_UINT:
                return $buffer->consumeUint64();
            case Constants::FIELD_FLOAT:
                return $buffer->consumeFloat();
            case Constants::FIELD_DOUBLE:
                return $buffer->consumeDouble();
            case Constants::FIELD_DECIMAL_VALUE:
                return $this->consumeDecimalValue($buffer);
            case Constants::FIELD_SHORT_STRING:
                return $buffer->consume($buffer->consumeUint8());
            case Constants::FIELD_LONG_STRING:
                return $buffer->consume($buffer->consumeUint32());
            case Constants::FIELD_ARRAY:
                return $this->consumeArray($buffer);
            case Constants::FIELD_TIMESTAMP:
                return $this->consumeTimestamp($buffer);
            case Constants::FIELD_TABLE:
                return $this->consumeTable($buffer);
            case Constants::FIELD_NULL:
                return null;

            default:
                throw new ProtocolException(
                    sprintf("Unhandled field type 0x%02x", $fieldType) .
                    (ctype_print(chr($fieldType)) ? " ('" . chr($fieldType) . "')" : "") .
                    "."
                );
        }
    }
176530
public function getData(ProductInterface $product)
    {
        $productItemData = [
            'id'          => $product->getId(),
            'sku'         => $product->getSku(),
            'name'        => $product->getName(),
            'price'       => $this->getProductPrice($product),
            'image'       => $this->getImageUrl($product),
            'score'       => $product->getDocumentScore(),
            'is_in_stock' => $this->isInStockProduct($product),
        ];

        return $productItemData;
    }
929978
public function getFormFieldValueOptions(FieldInterface $field)
    {
        $options = $field->getOptions();

        $message = '';
        if (isset($options['message'])) {
            $message = $options['message'];
        }

        return ['message' => $message];
    }
928849
public function consumeMethodFrame(Buffer $buffer)
    {
        $classId = $buffer->consumeUint16();
        $methodId = $buffer->consumeUint16();

        if ($classId === Constants::CLASS_CONNECTION) {
            if ($methodId === Constants::METHOD_CONNECTION_START) {
                $frame = new MethodConnectionStartFrame();
                $frame->versionMajor = $buffer->consumeUint8();
                $frame->versionMinor = $buffer->consumeUint8();
                $frame->serverProperties = $this->consumeTable($buffer);
                $frame->mechanisms = $buffer->consume($buffer->consumeUint32());
                $frame->locales = $buffer->consume($buffer->consumeUint32());
            } elseif ($methodId === Constants::METHOD_CONNECTION_START_OK) {
                $frame = new MethodConnectionStartOkFrame();
                $frame->clientProperties = $this->consumeTable($buffer);
                $frame->mechanism = $buffer->consume($buffer->consumeUint8());
                $frame->response = $buffer->consume($buffer->consumeUint32());
                $frame->locale = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_CONNECTION_SECURE) {
                $frame = new MethodConnectionSecureFrame();
                $frame->challenge = $buffer->consume($buffer->consumeUint32());
            } elseif ($methodId === Constants::METHOD_CONNECTION_SECURE_OK) {
                $frame = new MethodConnectionSecureOkFrame();
                $frame->response = $buffer->consume($buffer->consumeUint32());
            } elseif ($methodId === Constants::METHOD_CONNECTION_TUNE) {
                $frame = new MethodConnectionTuneFrame();
                $frame->channelMax = $buffer->consumeInt16();
                $frame->frameMax = $buffer->consumeInt32();
                $frame->heartbeat = $buffer->consumeInt16();
            } elseif ($methodId === Constants::METHOD_CONNECTION_TUNE_OK) {
                $frame = new MethodConnectionTuneOkFrame();
                $frame->channelMax = $buffer->consumeInt16();
                $frame->frameMax = $buffer->consumeInt32();
                $frame->heartbeat = $buffer->consumeInt16();
            } elseif ($methodId === Constants::METHOD_CONNECTION_OPEN) {
                $frame = new MethodConnectionOpenFrame();
                $frame->virtualHost = $buffer->consume($buffer->consumeUint8());
                $frame->capabilities = $buffer->consume($buffer->consumeUint8());
                list($frame->insist) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_CONNECTION_OPEN_OK) {
                $frame = new MethodConnectionOpenOkFrame();
                $frame->knownHosts = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_CONNECTION_CLOSE) {
                $frame = new MethodConnectionCloseFrame();
                $frame->replyCode = $buffer->consumeInt16();
                $frame->replyText = $buffer->consume($buffer->consumeUint8());
                $frame->closeClassId = $buffer->consumeInt16();
                $frame->closeMethodId = $buffer->consumeInt16();
            } elseif ($methodId === Constants::METHOD_CONNECTION_CLOSE_OK) {
                $frame = new MethodConnectionCloseOkFrame();
            } elseif ($methodId === Constants::METHOD_CONNECTION_BLOCKED) {
                $frame = new MethodConnectionBlockedFrame();
                $frame->reason = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_CONNECTION_UNBLOCKED) {
                $frame = new MethodConnectionUnblockedFrame();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_CHANNEL) {
            if ($methodId === Constants::METHOD_CHANNEL_OPEN) {
                $frame = new MethodChannelOpenFrame();
                $frame->outOfBand = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_CHANNEL_OPEN_OK) {
                $frame = new MethodChannelOpenOkFrame();
                $frame->channelId = $buffer->consume($buffer->consumeUint32());
            } elseif ($methodId === Constants::METHOD_CHANNEL_FLOW) {
                $frame = new MethodChannelFlowFrame();
                list($frame->active) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_CHANNEL_FLOW_OK) {
                $frame = new MethodChannelFlowOkFrame();
                list($frame->active) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_CHANNEL_CLOSE) {
                $frame = new MethodChannelCloseFrame();
                $frame->replyCode = $buffer->consumeInt16();
                $frame->replyText = $buffer->consume($buffer->consumeUint8());
                $frame->closeClassId = $buffer->consumeInt16();
                $frame->closeMethodId = $buffer->consumeInt16();
            } elseif ($methodId === Constants::METHOD_CHANNEL_CLOSE_OK) {
                $frame = new MethodChannelCloseOkFrame();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_ACCESS) {
            if ($methodId === Constants::METHOD_ACCESS_REQUEST) {
                $frame = new MethodAccessRequestFrame();
                $frame->realm = $buffer->consume($buffer->consumeUint8());
                list($frame->exclusive, $frame->passive, $frame->active, $frame->write, $frame->read) = $this->consumeBits($buffer, 5);
            } elseif ($methodId === Constants::METHOD_ACCESS_REQUEST_OK) {
                $frame = new MethodAccessRequestOkFrame();
                $frame->reserved1 = $buffer->consumeInt16();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_EXCHANGE) {
            if ($methodId === Constants::METHOD_EXCHANGE_DECLARE) {
                $frame = new MethodExchangeDeclareFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->exchangeType = $buffer->consume($buffer->consumeUint8());
                list($frame->passive, $frame->durable, $frame->autoDelete, $frame->internal, $frame->nowait) = $this->consumeBits($buffer, 5);
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_EXCHANGE_DECLARE_OK) {
                $frame = new MethodExchangeDeclareOkFrame();
            } elseif ($methodId === Constants::METHOD_EXCHANGE_DELETE) {
                $frame = new MethodExchangeDeleteFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                list($frame->ifUnused, $frame->nowait) = $this->consumeBits($buffer, 2);
            } elseif ($methodId === Constants::METHOD_EXCHANGE_DELETE_OK) {
                $frame = new MethodExchangeDeleteOkFrame();
            } elseif ($methodId === Constants::METHOD_EXCHANGE_BIND) {
                $frame = new MethodExchangeBindFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->destination = $buffer->consume($buffer->consumeUint8());
                $frame->source = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
                list($frame->nowait) = $this->consumeBits($buffer, 1);
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_EXCHANGE_BIND_OK) {
                $frame = new MethodExchangeBindOkFrame();
            } elseif ($methodId === Constants::METHOD_EXCHANGE_UNBIND) {
                $frame = new MethodExchangeUnbindFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->destination = $buffer->consume($buffer->consumeUint8());
                $frame->source = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
                list($frame->nowait) = $this->consumeBits($buffer, 1);
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_EXCHANGE_UNBIND_OK) {
                $frame = new MethodExchangeUnbindOkFrame();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_QUEUE) {
            if ($methodId === Constants::METHOD_QUEUE_DECLARE) {
                $frame = new MethodQueueDeclareFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                list($frame->passive, $frame->durable, $frame->exclusive, $frame->autoDelete, $frame->nowait) = $this->consumeBits($buffer, 5);
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_QUEUE_DECLARE_OK) {
                $frame = new MethodQueueDeclareOkFrame();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                $frame->messageCount = $buffer->consumeInt32();
                $frame->consumerCount = $buffer->consumeInt32();
            } elseif ($methodId === Constants::METHOD_QUEUE_BIND) {
                $frame = new MethodQueueBindFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
                list($frame->nowait) = $this->consumeBits($buffer, 1);
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_QUEUE_BIND_OK) {
                $frame = new MethodQueueBindOkFrame();
            } elseif ($methodId === Constants::METHOD_QUEUE_PURGE) {
                $frame = new MethodQueuePurgeFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                list($frame->nowait) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_QUEUE_PURGE_OK) {
                $frame = new MethodQueuePurgeOkFrame();
                $frame->messageCount = $buffer->consumeInt32();
            } elseif ($methodId === Constants::METHOD_QUEUE_DELETE) {
                $frame = new MethodQueueDeleteFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                list($frame->ifUnused, $frame->ifEmpty, $frame->nowait) = $this->consumeBits($buffer, 3);
            } elseif ($methodId === Constants::METHOD_QUEUE_DELETE_OK) {
                $frame = new MethodQueueDeleteOkFrame();
                $frame->messageCount = $buffer->consumeInt32();
            } elseif ($methodId === Constants::METHOD_QUEUE_UNBIND) {
                $frame = new MethodQueueUnbindFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_QUEUE_UNBIND_OK) {
                $frame = new MethodQueueUnbindOkFrame();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_BASIC) {
            if ($methodId === Constants::METHOD_BASIC_QOS) {
                $frame = new MethodBasicQosFrame();
                $frame->prefetchSize = $buffer->consumeInt32();
                $frame->prefetchCount = $buffer->consumeInt16();
                list($frame->global) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_QOS_OK) {
                $frame = new MethodBasicQosOkFrame();
            } elseif ($methodId === Constants::METHOD_BASIC_CONSUME) {
                $frame = new MethodBasicConsumeFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                $frame->consumerTag = $buffer->consume($buffer->consumeUint8());
                list($frame->noLocal, $frame->noAck, $frame->exclusive, $frame->nowait) = $this->consumeBits($buffer, 4);
                $frame->arguments = $this->consumeTable($buffer);
            } elseif ($methodId === Constants::METHOD_BASIC_CONSUME_OK) {
                $frame = new MethodBasicConsumeOkFrame();
                $frame->consumerTag = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_BASIC_CANCEL) {
                $frame = new MethodBasicCancelFrame();
                $frame->consumerTag = $buffer->consume($buffer->consumeUint8());
                list($frame->nowait) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_CANCEL_OK) {
                $frame = new MethodBasicCancelOkFrame();
                $frame->consumerTag = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_BASIC_PUBLISH) {
                $frame = new MethodBasicPublishFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
                list($frame->mandatory, $frame->immediate) = $this->consumeBits($buffer, 2);
            } elseif ($methodId === Constants::METHOD_BASIC_RETURN) {
                $frame = new MethodBasicReturnFrame();
                $frame->replyCode = $buffer->consumeInt16();
                $frame->replyText = $buffer->consume($buffer->consumeUint8());
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_BASIC_DELIVER) {
                $frame = new MethodBasicDeliverFrame();
                $frame->consumerTag = $buffer->consume($buffer->consumeUint8());
                $frame->deliveryTag = $buffer->consumeInt64();
                list($frame->redelivered) = $this->consumeBits($buffer, 1);
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_BASIC_GET) {
                $frame = new MethodBasicGetFrame();
                $frame->reserved1 = $buffer->consumeInt16();
                $frame->queue = $buffer->consume($buffer->consumeUint8());
                list($frame->noAck) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_GET_OK) {
                $frame = new MethodBasicGetOkFrame();
                $frame->deliveryTag = $buffer->consumeInt64();
                list($frame->redelivered) = $this->consumeBits($buffer, 1);
                $frame->exchange = $buffer->consume($buffer->consumeUint8());
                $frame->routingKey = $buffer->consume($buffer->consumeUint8());
                $frame->messageCount = $buffer->consumeInt32();
            } elseif ($methodId === Constants::METHOD_BASIC_GET_EMPTY) {
                $frame = new MethodBasicGetEmptyFrame();
                $frame->clusterId = $buffer->consume($buffer->consumeUint8());
            } elseif ($methodId === Constants::METHOD_BASIC_ACK) {
                $frame = new MethodBasicAckFrame();
                $frame->deliveryTag = $buffer->consumeInt64();
                list($frame->multiple) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_REJECT) {
                $frame = new MethodBasicRejectFrame();
                $frame->deliveryTag = $buffer->consumeInt64();
                list($frame->requeue) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_RECOVER_ASYNC) {
                $frame = new MethodBasicRecoverAsyncFrame();
                list($frame->requeue) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_RECOVER) {
                $frame = new MethodBasicRecoverFrame();
                list($frame->requeue) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_BASIC_RECOVER_OK) {
                $frame = new MethodBasicRecoverOkFrame();
            } elseif ($methodId === Constants::METHOD_BASIC_NACK) {
                $frame = new MethodBasicNackFrame();
                $frame->deliveryTag = $buffer->consumeInt64();
                list($frame->multiple, $frame->requeue) = $this->consumeBits($buffer, 2);
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_TX) {
            if ($methodId === Constants::METHOD_TX_SELECT) {
                $frame = new MethodTxSelectFrame();
            } elseif ($methodId === Constants::METHOD_TX_SELECT_OK) {
                $frame = new MethodTxSelectOkFrame();
            } elseif ($methodId === Constants::METHOD_TX_COMMIT) {
                $frame = new MethodTxCommitFrame();
            } elseif ($methodId === Constants::METHOD_TX_COMMIT_OK) {
                $frame = new MethodTxCommitOkFrame();
            } elseif ($methodId === Constants::METHOD_TX_ROLLBACK) {
                $frame = new MethodTxRollbackFrame();
            } elseif ($methodId === Constants::METHOD_TX_ROLLBACK_OK) {
                $frame = new MethodTxRollbackOkFrame();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } elseif ($classId === Constants::CLASS_CONFIRM) {
            if ($methodId === Constants::METHOD_CONFIRM_SELECT) {
                $frame = new MethodConfirmSelectFrame();
                list($frame->nowait) = $this->consumeBits($buffer, 1);
            } elseif ($methodId === Constants::METHOD_CONFIRM_SELECT_OK) {
                $frame = new MethodConfirmSelectOkFrame();
            } else {
                throw new InvalidMethodException($classId, $methodId);
            }
        } else {
            throw new InvalidClassException($classId);
        }

        $frame->classId = $classId;
        $frame->methodId = $methodId;

        return $frame;
    }
545336
public function getBuffer() : array
    {
        if($this->buffer !== null) {
            return $this->buffer;
        }

        $this->buffer = [];
        foreach ($this->reader->toArray() as $row => $children) {
            if(isset($this->buffer[$row]) == false) {
                $this->buffer[$row] = [];
            }

            foreach ($children as $col => $value) {
                $this->buffer[$row][$col] = [
                    'value' => $value,
                    'styles' => []
                ];
            }
        }

        return $this->buffer;
    }
1259192
private final function parseContext(RequestInterface $request): array
   {
       try {
           $header = "";
           foreach ($request->getHeaders() as $key => $value) {
               $header .= $key . ": " . implode("; ", $value) . "\r\n";
           }
           $request->getBody()->rewind();
       } catch (RuntimeException $e) {
       }
       return [
           "http" => [
               "method"  => $request->getMethod(),
               "header" => $header,
               "ignore_errors" => true,
               "content" => $request->getBody()->__toString()]
       ];
   }
109187
protected function output($buffer)
	{
		$buffer = $this->replaceInsertTags($buffer);
        $buffer = str_replace(array('{{request_token}}', '[{]', '[}]'), array(REQUEST_TOKEN, '{{', '}}'), $buffer);
        $buffer = str_replace('{{request_token}}', \RequestToken::get(), $buffer);

		if (is_array($buffer) || is_object($buffer))
		{
			$buffer = json_encode($buffer);
		}

		echo $buffer;
		exit;
	}
1223256
private function getVariables(TokenInterface $token): array
    {
        $roles = $this->roleHierarchy ? $this->roleHierarchy->getReachableRoles($token->getRoles()) : $token->getRoles();

        return [
            'token' => $token,
            'user' => $token->getUser(),
            'roles' => array_map(function (Role $role) {
                return $role->getRole();
            }, $roles),
            'trust_resolver' => $this->authenticationTrustResolver,
            // needed for the is_granted expression function
            'auth_checker' => $this->authorizationChecker,
        ];
    }
475663
protected static function getCheckoutBody(CheckoutInterface $checkout): array
    {
        return [
            "checkout_reference" => $checkout->getReference(),
            "amount" => $checkout->getAmount(),
            "currency" => $checkout->getCurrency(),
            "fee_amount" => $checkout->getFeeAmount(),
            "pay_to_email" => $checkout->getPayToEmail(),
            "pay_from_email" => $checkout->getPayFromEmail(),
            "description" => $checkout->getDescription(),
            "return_url" => $checkout->getRedirectUrl(),
        ];
    }