예제 #1
0
 /**
  * {@inheritDoc}
  */
 public function findMappingFile($className)
 {
     $fileName = str_replace('\\', '.', $className) . $this->fileExtension;
     // Check whether file exists
     foreach ($this->paths as $path) {
         if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) {
             return $path . DIRECTORY_SEPARATOR . $fileName;
         }
     }
     throw MappingException::mappingFileNotFound($className, $fileName);
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 public function findMappingFile($className)
 {
     $defaultFileName = str_replace('\\', '.', $className) . $this->fileExtension;
     foreach ($this->paths as $path) {
         if (!isset($this->prefixes[$path])) {
             if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) {
                 return $path . DIRECTORY_SEPARATOR . $defaultFileName;
             }
             continue;
         }
         $prefix = $this->prefixes[$path];
         if (0 !== strpos($className, $prefix . '\\')) {
             continue;
         }
         $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', '.') . $this->fileExtension;
         if (is_file($filename)) {
             return $filename;
         }
         throw MappingException::mappingFileNotFound($className, $filename);
     }
     throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->fileExtension);
 }