@param string     $chainName
@param string     $operationName
@param array      $data
@param ByteBuffer $byteBuffer

@return ByteBuffer
@throws \Exception
342034
public static function serializeOperation($chainName, $operationName, $data, $byteBuffer)
    {
        //operation id
        $opId = ChainOperations::getOperationId($chainName, $operationName);
        $byteBuffer->writeInt8($opId);

        foreach (self::getOpFieldsTypes($chainName, $operationName) as $field => $type) {
            self::serializeType($type, $data[$field], $byteBuffer);
        }

        return $byteBuffer;
    }
894798
@Override
    public synchronized ChainData removeChain(String chainName) throws ChainException {
        String entryMsg = "removeChain: " + chainName;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, entryMsg);
        }
        if (null == chainName) {
            throw new InvalidChainNameException("Input chain name is null");
        }

        // Look for runtime chains.
        Chain chain = chainRunningMap.get(chainName);
        if (chain != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                // Due to timing windows (i.e. multiple channel providers going away), there is
                // a race to stop and/or clean up chains. This is not a notable condition: the chain can only be removed
                // once.
                Tr.exit(tc, entryMsg, "Chain not found");
            }
            return null;
        }

        // Find the chain config
        ChainData chainData = chainDataMap.get(chainName);
        if (null == chainData) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                // Due to timing windows (i.e. multiple channel providers going away), there is
                // a race to stop and/or clean up chains. This is not a notable condition: the chain can only be removed
                // once.
                Tr.exit(tc, entryMsg, "ChainData not found");
            }
            return null;
        }
        removeChainInternal(chainData);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, entryMsg);
        }
        return chainData;
    }
421340
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write($data);
    }
393859
public static <T> T fromByteArrayKryo(byte[] data, Class<T> clazz) {
        return fromByteArrayKryo(data, clazz, null);
    }
648444
public function serializeToDom($data, string $tagName = null): \DOMDocument
    {
        return $this->xmlSerializer->serialize($data, $this->xmlStreamWriter, $tagName)
               ->asDOM();
    }
530180
private DataBuffer withDataBufferFactory(ByteBufHttpData data) {
        final byte[] dataArray = ByteBufUtil.getBytes(data.content());
        data.release();
        return delegate.wrap(dataArray);
    }
96399
public function flowQueryAction(array $chain)
    {
        $createContext = array_shift($chain);
        $finisher = array_pop($chain);

        $flowQuery = new FlowQuery(array_map(
            function ($envelope) {
                return $this->nodeService->getNodeFromContextPath($envelope['$node']);
            },
            $createContext['payload']
        ));

        foreach ($chain as $operation) {
            $flowQuery = call_user_func_array([$flowQuery, $operation['type']], $operation['payload']);
        }

        $nodeInfoHelper = new NodeInfoHelper();
        $result = [];
        switch ($finisher['type']) {
            case 'get':
                $result = $nodeInfoHelper->renderNodes($flowQuery->get(), $this->getControllerContext());
            break;
            case 'getForTree':
                $result = $nodeInfoHelper->renderNodes($flowQuery->get(), $this->getControllerContext(), true);
            break;
            case 'getForTreeWithParents':
                $result = $nodeInfoHelper->renderNodesWithParents($flowQuery->get(), $this->getControllerContext());
            break;
        }

        return json_encode($result);
    }
1325491
private function hydrateToManyRelation($entity, $name, $targetEntity, $data, $scope)
    {
        if (!is_array($data)) {
            throw RestException::missingData($scope);
        }

        $this->setObjectProperty($entity, $name,
            new ArrayCollection(array_map(
                function($item, $index) use ($targetEntity, $scope) {
                    return $this->hydrateRelationData($targetEntity, $item, $scope.'['.$index.']');
                },
                $data,
                array_keys($data)
            ))
        );
    }
988940
public static function getOperationId($chainName, $operationName)
    {
        if (!isset(self::$opMap[$chainName])) {
            if ($chainName === ConnectorInterface::PLATFORM_GOLOS) {
                $op = ChainOperationsGolos::IDS;
            } elseif ($chainName === ConnectorInterface::PLATFORM_STEEMIT) {
                $op = ChainOperationsSteem::IDS;
            } elseif ($chainName === ConnectorInterface::PLATFORM_VIZ) {
                $op = ChainOperationsViz::IDS;
            } elseif ($chainName === ConnectorInterface::PLATFORM_WHALESHARES) {
                $op = ChainOperationsWhaleshares::IDS;
            } else {
                throw new \Exception("There is no operations id's for '{$chainName}'");
            }
            self::$opMap[$chainName] = $op;
        }

        if (!isset(self::$opMap[$chainName][$operationName])) {
            throw new \Exception("There is no information about operation:'{$operationName}'. Please add ID for this operation");
        }

        return self::$opMap[$chainName][$operationName];
    }
936025
public static function createTransaction(array $data = [])
    {
        $entity = null;
        switch ($data['type']) {
            case 'broadcast':
                $entity = self::create('BroadcastTransaction', $data);
                break;
            case 'account_created':
            case 'change_account_key':
            case 'change_node_key':
                $entity = self::create('KeyTransaction', $data);
                break;
            case 'connection':
                $entity = self::create('ConnectionTransaction', $data);
                break;
            case 'create_account':
            case 'create_node':
            case 'retrieve_funds':
                $entity = self::create('NetworkTransaction', $data);
                break;
            case 'log_account':
                $entity = self::create('LogAccountTransaction', $data);
                break;
            case 'send_many':
                $entity = self::create('SendManyTransaction', $data);
                break;
            case 'send_one':
                $entity = self::create('SendOneTransaction', $data);
                break;
            case 'set_account_status':
            case 'set_node_status':
            case 'unset_account_status':
            case 'unset_node_status':
                $entity = self::create('StatusTransaction', $data);
                break;
            case 'empty':
                $entity = self::create('EmptyTransaction', $data);
                break;
            default:
                throw new AdsException(sprintf('Unsupported transaction type "%s".', $data['type']));
        }

        return $entity;
    }
1072010
public function startSpan($operationName, $options = []){

        if (is_array($options)) {
            $options = SpanOptions::create($options);
        }else{
            throw new \Exception("options is not array");
        }

        $references = $options->getReferences();

        $hasParent = false;
        $parentSpan = null;

        foreach ($references as $ref){
            if($ref->isType(Reference::CHILD_OF)){
                $hasParent = true;
                $parentSpan = $ref->getContext();
            }
        }

        if(!$hasParent || !$parentSpan->traceIdLow){
            $low = $this->generateId();
            $spanId = $low;
            $flags = $this->sampler->IsSampled();
            $newSpan = new \Jaeger\SpanContext($spanId, 0, $flags, null, 0);
            $newSpan->traceIdLow = $low;
            if($this->gen128bit == true){
                $newSpan->traceIdHigh = $this->generateId();
            }
        }else{
            $newSpan = new \Jaeger\SpanContext($this->generateId(),
                $parentSpan->spanId, $parentSpan->flags, null, 0);
            $newSpan->traceIdLow = $parentSpan->traceIdLow;
            if($parentSpan->traceIdHigh){
                $newSpan->traceIdHigh = $parentSpan->traceIdHigh;
            }
        }

        $span = new Span($operationName, $newSpan, $references);
        $span->setTags($options->getTags());

        if($newSpan->isSampled() == 1) {
            $this->spans[] = $span;
        }

        return $span;
    }
518752
public static function getException($transactionId, $responseCode, $responseText, $item)
    {
        $responseCode = (string)$responseCode;
        $code = null;
        $message = null;

        if ($responseCode == '00') {
            return null;
        }

        if (isset($item->Processor) && isset($item->Processor->Response)) {
            $error = self::nvpToArray($item->Processor->Response);
            $code = $error['Code'];
            $message = $error['Message'];
        }

        return new HpsProcessorException($transactionId, $code, $message, $responseCode, $responseText);
    }
399347
public function processMessage(ConnectionInterface $conn, $data)
    {
        $array = json_decode($data, true);

        $method = 'command' . ucfirst($array['cmd']);
        if (is_callable([$this, $method])) {
            $this->$method($array, $conn);
        } else {
            throw new \Exception(sprintf('Command %s not found. Got %s', $method, $data));
        }
    }
659268
@Override
    public DataBuffer createDouble(double[] data, boolean copy, MemoryWorkspace workspace) {
        return new CudaDoubleDataBuffer(data, copy, workspace);
    }
126881
public static function getOpFieldsTypes($chainName, $operationName)
    {
        if (!isset(self::$opFieldsMap[$chainName])) {
            if ($chainName === ConnectorInterface::PLATFORM_GOLOS) {
                $op = ChainOperationsGolos::FIELDS_TYPES;
            } elseif ($chainName === ConnectorInterface::PLATFORM_STEEMIT) {
                $op = ChainOperationsSteem::FIELDS_TYPES;
            } elseif ($chainName === ConnectorInterface::PLATFORM_VIZ) {
                $op = ChainOperationsViz::FIELDS_TYPES;
            } elseif ($chainName === ConnectorInterface::PLATFORM_WHALESHARES) {
                $op = ChainOperationsWhaleshares::FIELDS_TYPES;
            } else {
                throw new \Exception("There is no operations fields for '{$chainName}'");
            }
            self::$opFieldsMap[$chainName] = $op;
        }

        if (!isset(self::$opFieldsMap[$chainName][$operationName])) {
            throw new \Exception("There is no information about fields of operation:'{$operationName}'. Please add fields for this operation");
        }

        return self::$opFieldsMap[$chainName][$operationName];
    }
168026
@Override public byte[] apply(byte[] data, int offset, int length) throws Exception {
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(data, offset, length);
        byte command=in.readByte();
        switch(command) {
            case PUT:
                K key=Util.objectFromStream(in);
                V val=Util.objectFromStream(in);
                V old_val=map.put(key, val);
                notifyPut(key, val, old_val);
                return old_val == null? null : Util.objectToByteBuffer(old_val);
            case REMOVE:
                key=Util.objectFromStream(in);
                old_val=map.remove(key);
                notifyRemove(key, old_val);
                return old_val == null? null : Util.objectToByteBuffer(old_val);
            default:
                throw new IllegalArgumentException("command " + command + " is unknown");
        }
    }
645962
@Override
    public synchronized ChannelData removeChannel(String channelName) throws ChannelException, ChainException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "removeChannel: " + channelName);
        }
        if (null == channelName) {
            throw new InvalidChannelNameException("Input channel name is null");
        }

        // Fetch the channel data from the framework.
        ChannelDataImpl channelData = (ChannelDataImpl) channelDataMap.get(channelName);
        if (null == channelData) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                // Due to timing windows (i.e. multiple channel providers going away), there is
                // a race to stop and/or clean up chains. This is not a notable condition: the chain can only be removed
                // once.
                Tr.exit(tc, "removeChannel: " + channelName, "Channel not found");
            }
            return null;
        }

        // Channel configs can only be removed if they are not in use by the
        // runtime.
        if (0 != channelData.getNumChildren()) {
            throw new ChannelException("Can't remove channel config " + channelName + " in runtime.  Destroy must happen first. ");
        }

        // Remove the chain config from the framework's map.
        this.channelDataMap.remove(channelName);

        // iterating chain configs will clear out live chains/channelRunningMap
        // Remove any chain configurations that refer to this channel.
        // Get a temp array so we can release the lock needed by removeChain.
        // This isn't a clone, but we should be okay holding the references.
        Object[] chainDataArray = this.chainDataMap.values().toArray();
        ChainDataImpl chainData = null;
        for (int i = 0; i < chainDataArray.length; i++) {
            chainData = (ChainDataImpl) chainDataArray[i];
            if (chainData.containsChannel(channelName)) {
                // Found reference to channel config. Remove chain config.
                // This ripples into the chain groups and cleans them up too.
                removeChain(chainData.getName());
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "removeChannel");
        }
        return channelData;
    }