original_string: public static function fromMetadataDriver(MappingDriver $omDriver)
      {
          if ($omDriver instanceof MappingDriverChain) {
              $drivers = array();
              foreach ($omDriver->getDrivers() as $nestedOmDriver) {
                  $drivers[] = self::fromMetadataDriver($nestedOmDriver);
              }
  
              return new DriverChain($drivers);
          }
  
          if ($omDriver instanceof DoctrineAnnotationDriver) {
              return new AnnotationDriver($omDriver->getReader());
          }
  
          if ($omDriver instanceof DoctrineFileDriver) {
              $reflClass = new \ReflectionClass($omDriver);
  
              $driverName = $reflClass->getShortName();
              if ($omDriver instanceof SimplifiedYamlDriver || $omDriver instanceof SimplifiedXmlDriver) {
                  $driverName = str_replace('Simplified', '', $driverName);
              }
  
              $class = 'Prezent\\Doctrine\\Translatable\\Mapping\\Driver\\' . $driverName;
  
              if (class_exists($class)) {
                  return new $class($omDriver->getLocator());
              }
          }
  
          throw new \InvalidArgumentException('Cannot adapt Doctrine driver of class ' . get_class($omDriver));
      }
code: public static function fromMetadataDriver(MappingDriver $omDriver)
      {
          if ($omDriver instanceof MappingDriverChain) {
              $drivers = array();
              foreach ($omDriver->getDrivers() as $nestedOmDriver) {
                  $drivers[] = self::fromMetadataDriver($nestedOmDriver);
              }
  
              return new DriverChain($drivers);
          }
  
          if ($omDriver instanceof DoctrineAnnotationDriver) {
              return new AnnotationDriver($omDriver->getReader());
          }
  
          if ($omDriver instanceof DoctrineFileDriver) {
              $reflClass = new \ReflectionClass($omDriver);
  
              $driverName = $reflClass->getShortName();
              if ($omDriver instanceof SimplifiedYamlDriver || $omDriver instanceof SimplifiedXmlDriver) {
                  $driverName = str_replace('Simplified', '', $driverName);
              }
  
              $class = 'Prezent\\Doctrine\\Translatable\\Mapping\\Driver\\' . $driverName;
  
              if (class_exists($class)) {
                  return new $class($omDriver->getLocator());
              }
          }
  
          throw new \InvalidArgumentException('Cannot adapt Doctrine driver of class ' . get_class($omDriver));
      }
code_tokens: public static function fromMetadataDriver ( MappingDriver $ omDriver ) { if ( $ omDriver instanceof MappingDriverChain ) { $ drivers = array ( ) ; foreach ( $ omDriver -> getDrivers ( ) as $ nestedOmDriver ) { $ drivers [ ] = self :: fromMetadataDriver ( $ nestedOmDriver ) ; } return new DriverChain ( $ drivers ) ; } if ( $ omDriver instanceof DoctrineAnnotationDriver ) { return new AnnotationDriver ( $ omDriver -> getReader ( ) ) ; } if ( $ omDriver instanceof DoctrineFileDriver ) { $ reflClass = new \ ReflectionClass ( $ omDriver ) ; $ driverName = $ reflClass -> getShortName ( ) ; if ( $ omDriver instanceof SimplifiedYamlDriver || $ omDriver instanceof SimplifiedXmlDriver ) { $ driverName = str_replace ( 'Simplified' , '' , $ driverName ) ; } $ class = 'Prezent\\Doctrine\\Translatable\\Mapping\\Driver\\' . $ driverName ; if ( class_exists ( $ class ) ) { return new $ class ( $ omDriver -> getLocator ( ) ) ; } } throw new \ InvalidArgumentException ( 'Cannot adapt Doctrine driver of class ' . get_class ( $ omDriver ) ) ; }
docstring: Create a driver from a Doctrine metadata driver
  
  @param MappingDriver $omDriver
  @return DriverInterface
docstring_tokens: Create a driver from a Doctrine metadata driver