DrupalExtensionUnderscoreFinderPlugin.php in X Autoload 7.5
File
src/ClassFinder/Plugin/DrupalExtensionUnderscoreFinderPlugin.php
View source
<?php
namespace Drupal\xautoload\ClassFinder\Plugin;
class DrupalExtensionUnderscoreFinderPlugin extends DrupalExtensionNamespaceFinderPlugin {
function findFile($api, $logical_base_path, $relative_path, $extension_name = NULL) {
$extension_file = $this->system
->drupalGetFilename($this->type, $extension_name);
if (empty($extension_file)) {
return FALSE;
}
$nspath = 'Drupal/' . $extension_name . '/';
$testpath = $nspath . 'Tests/';
$uspath = $extension_name . '/';
$lib = dirname($extension_file) . '/lib/';
$lib_psr0 = $lib . 'Drupal/' . $extension_name . '/';
if ($api
->guessPath($lib . $relative_path)) {
$this->prefixMap
->registerDeepPath($uspath, $lib, $this->defaultBehavior);
$this->namespaceMap
->unregisterDeepPath($nspath, $extension_name);
$this->prefixMap
->unregisterDeepPath($uspath, $extension_name);
if (is_dir($lib_psr0 . 'Tests/')) {
$this->namespaceMap
->registerDeepPath($testpath, $lib_psr0 . 'Tests/', $this->psr0Behavior);
}
if (is_dir($lib . 'Tests/')) {
$this->namespaceMap
->registerDeepPath($testpath, $lib . 'Tests/', $this->defaultBehavior);
}
return TRUE;
}
return FALSE;
}
}