src/Serializer.php
protected function packValue($value): string
    {
        if ($value instanceof DeclarationInterface) {
            //No indentation here
            return $value->render();
        }

        if (is_null($value)) {
            return "null";
        }

        if (is_bool($value)) {
            return ($value ? "true" : "false");
        }

        if (is_object($value) && method_exists($value, '__set_state')) {
            return var_export($value, true);
        }

        if (!is_string($value) && !is_numeric($value)) {
            throw new SerializeException("Unable to pack non scalar value");
        }

        if (is_string($value) && class_exists($value)) {
            $reflection = new \ReflectionClass($value);
            if ($value === $reflection->getName()) {
                return '\\' . $reflection->getName() . '::class';
            }
        }

        return var_export($value, true);
    }
protected function packValue($value): string
    {
        if ($value instanceof DeclarationInterface) {
            //No indentation here
            return $value->render();
        }

        if (is_null($value)) {
            return "null";
        }

        if (is_bool($value)) {
            return ($value ? "true" : "false");
        }

        if (is_object($value) && method_exists($value, '__set_state')) {
            return var_export($value, true);
        }

        if (!is_string($value) && !is_numeric($value)) {
            throw new SerializeException("Unable to pack non scalar value");
        }

        if (is_string($value) && class_exists($value)) {
            $reflection = new \ReflectionClass($value);
            if ($value === $reflection->getName()) {
                return '\\' . $reflection->getName() . '::class';
            }
        }

        return var_export($value, true);
    }
protected function packValue ( $ value ) : string { if ( $ value instanceof DeclarationInterface ) { //No indentation here return $ value -> render ( ) ; } if ( is_null ( $ value ) ) { return "null" ; } if ( is_bool ( $ value ) ) { return ( $ value ? "true" : "false" ) ; } if ( is_object ( $ value ) && method_exists ( $ value , '__set_state' ) ) { return var_export ( $ value , true ) ; } if ( ! is_string ( $ value ) && ! is_numeric ( $ value ) ) { throw new SerializeException ( "Unable to pack non scalar value" ) ; } if ( is_string ( $ value ) && class_exists ( $ value ) ) { $ reflection = new \ ReflectionClass ( $ value ) ; if ( $ value === $ reflection -> getName ( ) ) { return '\\' . $ reflection -> getName ( ) . '::class' ; } } return var_export ( $ value , true ) ; }
Pack array key value into string.

@param mixed $value

@return string
@throws SerializeException
Pack array key value into string .