public function getComputeSizeMetadata($type)
    {
        $data = [
            'method' => null,
            'size'   => null
        ];

        $dynamicMapping = [
            Type::TYPE_INT32_VALUE  => 'computeVarintSize',
            Type::TYPE_INT64_VALUE  => 'computeVarintSize',
            Type::TYPE_UINT64_VALUE => 'computeVarintSize',
            Type::TYPE_UINT32_VALUE => 'computeVarintSize',
            Type::TYPE_ENUM_VALUE   => 'computeVarintSize',
            Type::TYPE_STRING_VALUE => 'computeStringSize',
            Type::TYPE_SINT32_VALUE => 'computeZigzag32Size',
            Type::TYPE_SINT64_VALUE => 'computeZigzag64Size',
            Type::TYPE_BYTES_VALUE  => 'computeByteStreamSize',
        ];

        if (isset($dynamicMapping[$type])) {
            $data['method'] = $dynamicMapping[$type];

            return $data;
        }

        if ($type === Type::TYPE_DOUBLE_VALUE) {
            $data['method'] = 'computeDoubleSize';
            $data['size']   = $this->getSizeCalculator()->computeDoubleSize();

            return $data;
        }

        if ($type === Type::TYPE_FLOAT_VALUE) {
            $data['method'] = 'computeFloatSize';
            $data['size']   = $this->getSizeCalculator()->computeFloatSize();

            return $data;
        }

        if ($type === Type::TYPE_BOOL_VALUE) {
            $data['method'] = 'computeBoolSize';
            $data['size']   = $this->getSizeCalculator()->computeBoolSize();

            return $data;
        }

        if ($type === Type::TYPE_FIXED64_VALUE) {
            $data['method'] = 'computeFixed64Size';
            $data['size']   = $this->getSizeCalculator()->computeFixed64Size();

            return $data;
        }

        if ($type === Type::TYPE_SFIXED64_VALUE) {
            $data['method'] = 'computeSFixed64Size';
            $data['size']   = $this->getSizeCalculator()->computeSFixed64Size();

            return $data;
        }

        if ($type === Type::TYPE_FIXED32_VALUE) {
            $data['method'] = 'computeFixed32Size';
            $data['size']   = $this->getSizeCalculator()->computeFixed32Size();

            return $data;
        }

        if ($type === Type::TYPE_SFIXED32_VALUE) {
            $data['method'] = 'computeSFixed32Size';
            $data['size']   = $this->getSizeCalculator()->computeSFixed32Size();

            return $data;
        }

        throw new \Exception('Unknown field type ' . $type);
    }
public function getComputeSizeMetadata($type)
    {
        $data = [
            'method' => null,
            'size'   => null
        ];

        $dynamicMapping = [
            Type::TYPE_INT32_VALUE  => 'computeVarintSize',
            Type::TYPE_INT64_VALUE  => 'computeVarintSize',
            Type::TYPE_UINT64_VALUE => 'computeVarintSize',
            Type::TYPE_UINT32_VALUE => 'computeVarintSize',
            Type::TYPE_ENUM_VALUE   => 'computeVarintSize',
            Type::TYPE_STRING_VALUE => 'computeStringSize',
            Type::TYPE_SINT32_VALUE => 'computeZigzag32Size',
            Type::TYPE_SINT64_VALUE => 'computeZigzag64Size',
            Type::TYPE_BYTES_VALUE  => 'computeByteStreamSize',
        ];

        if (isset($dynamicMapping[$type])) {
            $data['method'] = $dynamicMapping[$type];

            return $data;
        }

        if ($type === Type::TYPE_DOUBLE_VALUE) {
            $data['method'] = 'computeDoubleSize';
            $data['size']   = $this->getSizeCalculator()->computeDoubleSize();

            return $data;
        }

        if ($type === Type::TYPE_FLOAT_VALUE) {
            $data['method'] = 'computeFloatSize';
            $data['size']   = $this->getSizeCalculator()->computeFloatSize();

            return $data;
        }

        if ($type === Type::TYPE_BOOL_VALUE) {
            $data['method'] = 'computeBoolSize';
            $data['size']   = $this->getSizeCalculator()->computeBoolSize();

            return $data;
        }

        if ($type === Type::TYPE_FIXED64_VALUE) {
            $data['method'] = 'computeFixed64Size';
            $data['size']   = $this->getSizeCalculator()->computeFixed64Size();

            return $data;
        }

        if ($type === Type::TYPE_SFIXED64_VALUE) {
            $data['method'] = 'computeSFixed64Size';
            $data['size']   = $this->getSizeCalculator()->computeSFixed64Size();

            return $data;
        }

        if ($type === Type::TYPE_FIXED32_VALUE) {
            $data['method'] = 'computeFixed32Size';
            $data['size']   = $this->getSizeCalculator()->computeFixed32Size();

            return $data;
        }

        if ($type === Type::TYPE_SFIXED32_VALUE) {
            $data['method'] = 'computeSFixed32Size';
            $data['size']   = $this->getSizeCalculator()->computeSFixed32Size();

            return $data;
        }

        throw new \Exception('Unknown field type ' . $type);
    }
public function getComputeSizeMetadata ( $ type ) { $ data = [ 'method' => null , 'size' => null ] ; $ dynamicMapping = [ Type :: TYPE_INT32_VALUE => 'computeVarintSize' , Type :: TYPE_INT64_VALUE => 'computeVarintSize' , Type :: TYPE_UINT64_VALUE => 'computeVarintSize' , Type :: TYPE_UINT32_VALUE => 'computeVarintSize' , Type :: TYPE_ENUM_VALUE => 'computeVarintSize' , Type :: TYPE_STRING_VALUE => 'computeStringSize' , Type :: TYPE_SINT32_VALUE => 'computeZigzag32Size' , Type :: TYPE_SINT64_VALUE => 'computeZigzag64Size' , Type :: TYPE_BYTES_VALUE => 'computeByteStreamSize' , ] ; if ( isset ( $ dynamicMapping [ $ type ] ) ) { $ data [ 'method' ] = $ dynamicMapping [ $ type ] ; return $ data ; } if ( $ type === Type :: TYPE_DOUBLE_VALUE ) { $ data [ 'method' ] = 'computeDoubleSize' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeDoubleSize ( ) ; return $ data ; } if ( $ type === Type :: TYPE_FLOAT_VALUE ) { $ data [ 'method' ] = 'computeFloatSize' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeFloatSize ( ) ; return $ data ; } if ( $ type === Type :: TYPE_BOOL_VALUE ) { $ data [ 'method' ] = 'computeBoolSize' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeBoolSize ( ) ; return $ data ; } if ( $ type === Type :: TYPE_FIXED64_VALUE ) { $ data [ 'method' ] = 'computeFixed64Size' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeFixed64Size ( ) ; return $ data ; } if ( $ type === Type :: TYPE_SFIXED64_VALUE ) { $ data [ 'method' ] = 'computeSFixed64Size' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeSFixed64Size ( ) ; return $ data ; } if ( $ type === Type :: TYPE_FIXED32_VALUE ) { $ data [ 'method' ] = 'computeFixed32Size' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeFixed32Size ( ) ; return $ data ; } if ( $ type === Type :: TYPE_SFIXED32_VALUE ) { $ data [ 'method' ] = 'computeSFixed32Size' ; $ data [ 'size' ] = $ this -> getSizeCalculator ( ) -> computeSFixed32Size ( ) ; return $ data ; } throw new \ Exception ( 'Unknown field type ' . $ type ) ; }
compute value size

@param string  $type

@return string
compute value size