original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Gets the SPI object for the given session. If there is already a SPI
  object in the session it will be returned. If there is no SPI object it
  will be created and put into the session.
  
  @param BindingSessionInterface $session
  @return CmisInterface
docstring_tokens: Gets the SPI object for the given session . If there is already a SPI object in the session it will be returned . If there is no SPI object it will be created and put into the session .