get_file_dirs() public static method

public static get_file_dirs ( )
Beispiel #1
0
 public function get_component()
 {
     $components = array();
     foreach ($this->trace as $item) {
         try {
             if (isset($item['file'])) {
                 $file = $item['file'];
             } else {
                 if (isset($item['class'])) {
                     if (!is_object($item['class']) and !class_exists($item['class'], false)) {
                         continue;
                     }
                     if (!method_exists($item['class'], $item['function'])) {
                         continue;
                     }
                     $ref = new ReflectionMethod($item['class'], $item['function']);
                     $file = $ref->getFileName();
                 } else {
                     if (!function_exists($item['function'])) {
                         continue;
                     }
                     $ref = new ReflectionFunction($item['function']);
                     $file = $ref->getFileName();
                 }
             }
             $comp = QM_Util::get_file_component($file);
             $components[$comp->type] = $comp;
         } catch (ReflectionException $e) {
             # nothing
         }
     }
     foreach (QM_Util::get_file_dirs() as $type => $dir) {
         if (isset($components[$type])) {
             return $components[$type];
         }
     }
     # This should not happen
 }