public function getSpi(BindingSessionInterface $session)
    {
        $spi = $session->get(self::SPI_OBJECT);

        if ($spi !== null) {
            return $spi;
        }

        $spiClass = $session->get(SessionParameter::BINDING_CLASS);
        if (empty($spiClass) || !class_exists($spiClass)) {
            throw new CmisRuntimeException(
                sprintf('The given binding class "%s" is not valid!', $spiClass)
            );
        }

        if (!is_a($spiClass, CmisInterface::class, true)) {
            throw new CmisRuntimeException(
                sprintf('The given binding class "%s" does not implement required CmisInterface!', $spiClass)
            );
        }

        try {
            $spi = new $spiClass($session);
        } catch (\Exception $exception) {
            throw new CmisRuntimeException(
                sprintf('Could not create object of type "%s"!', $spiClass),
                null,
                $exception
            );
        }

        $session->put(self::SPI_OBJECT, $spi);

        return $spi;
    }