function encodeType($value, \Plasma\ColumnDefinitionInterface $column): \Plasma\Types\TypeExtensionResultInterface {
        $type = \gettype($value);
        if($type === 'double') {
            $type = 'float';
        }
        
        if($type === 'object') {
            $classes = \array_merge(
                array(\get_class($value)),
                \class_parents($value),
                \class_implements($value)
            );
            
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->classTypes as $key => $encoder) {
                if(\in_array($key, $classes, true)) {
                    return $encoder->encode($value, $column);
                }
            }
        }
        
        /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
        foreach($this->regularTypes as $key => $encoder) {
            if($type === $key) {
                return $encoder->encode($value, $column);
            }
        }
        
        if($this->enabledFuzzySearch) {
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->classTypes as $key => $encoder) {
                if($encoder->canHandleType($value, $column)) {
                    return $encoder->encode($value, $column);
                }
            }
            
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->regularTypes as $key => $encoder) {
                if($encoder->canHandleType($value, $column)) {
                    return $encoder->encode($value, $column);
                }
            }
        }
        
        throw new \Plasma\Exception('Unable to encode given value');
    }
function encodeType($value, \Plasma\ColumnDefinitionInterface $column): \Plasma\Types\TypeExtensionResultInterface {
        $type = \gettype($value);
        if($type === 'double') {
            $type = 'float';
        }
        
        if($type === 'object') {
            $classes = \array_merge(
                array(\get_class($value)),
                \class_parents($value),
                \class_implements($value)
            );
            
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->classTypes as $key => $encoder) {
                if(\in_array($key, $classes, true)) {
                    return $encoder->encode($value, $column);
                }
            }
        }
        
        /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
        foreach($this->regularTypes as $key => $encoder) {
            if($type === $key) {
                return $encoder->encode($value, $column);
            }
        }
        
        if($this->enabledFuzzySearch) {
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->classTypes as $key => $encoder) {
                if($encoder->canHandleType($value, $column)) {
                    return $encoder->encode($value, $column);
                }
            }
            
            /** @var \Plasma\Types\TypeExtensionInterface  $encoder */
            foreach($this->regularTypes as $key => $encoder) {
                if($encoder->canHandleType($value, $column)) {
                    return $encoder->encode($value, $column);
                }
            }
        }
        
        throw new \Plasma\Exception('Unable to encode given value');
    }
function encodeType ( $ value , \ Plasma \ ColumnDefinitionInterface $ column ) : \ Plasma \ Types \ TypeExtensionResultInterface { $ type = \ gettype ( $ value ) ; if ( $ type === 'double' ) { $ type = 'float' ; } if ( $ type === 'object' ) { $ classes = \ array_merge ( array ( \ get_class ( $ value ) ) , \ class_parents ( $ value ) , \ class_implements ( $ value ) ) ; /** @var \Plasma\Types\TypeExtensionInterface  $encoder */ foreach ( $ this -> classTypes as $ key => $ encoder ) { if ( \ in_array ( $ key , $ classes , true ) ) { return $ encoder -> encode ( $ value , $ column ) ; } } } /** @var \Plasma\Types\TypeExtensionInterface  $encoder */ foreach ( $ this -> regularTypes as $ key => $ encoder ) { if ( $ type === $ key ) { return $ encoder -> encode ( $ value , $ column ) ; } } if ( $ this -> enabledFuzzySearch ) { /** @var \Plasma\Types\TypeExtensionInterface  $encoder */ foreach ( $ this -> classTypes as $ key => $ encoder ) { if ( $ encoder -> canHandleType ( $ value , $ column ) ) { return $ encoder -> encode ( $ value , $ column ) ; } } /** @var \Plasma\Types\TypeExtensionInterface  $encoder */ foreach ( $ this -> regularTypes as $ key => $ encoder ) { if ( $ encoder -> canHandleType ( $ value , $ column ) ) { return $ encoder -> encode ( $ value , $ column ) ; } } } throw new \ Plasma \ Exception ( 'Unable to encode given value' ) ; }
Tries to encode a value.
@param mixed                              $value
@param \Plasma\ColumnDefinitionInterface  $column
@return \Plasma\Types\TypeExtensionResultInterface
@throws \Plasma\Exception  Thrown if unable to encode the value.
Tries to encode a value .