Exemplo n.º 1
0
Arquivo: Dt.php Projeto: tokushima/ebi
 /**
  * エントリのURL群
  * @param string $dir
  * @return array
  */
 public static function get_urls($dir = null)
 {
     if (empty($dir)) {
         $dir = getcwd();
     }
     $urls = [];
     foreach (new \RecursiveDirectoryIterator($dir, \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS) as $f) {
         if (substr($f->getFilename(), -4) == '.php' && !preg_match('/\\/[\\._]/', $f->getPathname())) {
             $entry_name = substr($f->getFilename(), 0, -4);
             $src = file_get_contents($f->getPathname());
             if (strpos($src, 'Flow') !== false) {
                 $entry_name = substr($f->getFilename(), 0, -4);
                 $map = \ebi\Flow::get_map($f->getPathname());
                 foreach ($map['patterns'] as $m) {
                     $urls[$entry_name . '::' . $m['name']] = $m['format'];
                 }
             }
         }
     }
     return $urls;
 }
Exemplo n.º 2
0
        \cmdman\Std::println_success(' ' . $class_name . ' OK');
    } catch (\ebi\exception\NotFoundException $e) {
    } catch (\ebi\exception\ConnectionException $e) {
        $failure['db']++;
        \cmdman\Std::println_danger(' ' . $class_name . ' Failure, ' . $e->getMessage());
    } catch (\Exception $e) {
        $failure['db']++;
        \cmdman\Std::println_warning(' ' . $class_name . ' Failure, ' . $e->getMessage());
    }
}
\cmdman\Std::println();
\cmdman\Std::println_info('Entry:');
foreach (\ebi\Util::ls(getcwd()) as $f) {
    $src = file_get_contents($f->getPathname());
    if (strpos($src, '\\ebi\\Flow::app(') !== false) {
        $map = \ebi\Flow::get_map($f->getPathname());
        $entry = str_replace(getcwd(), '', $f->getPathname());
        foreach ($map['patterns'] as $p) {
            if (array_key_exists('action', $p) && is_string($p['action'])) {
                try {
                    list($c, $m) = explode('::', $p['action']);
                    $mr = new \ReflectionMethod(\ebi\Util::get_class_name($c), $m);
                    \cmdman\Std::println_success($entry . ' ' . $p['name'] . ' OK');
                } catch (\ReflectionException $e) {
                    $failure['entry']++;
                    \cmdman\Std::println_danger($entry . ' ' . $p['name'] . ' Failure');
                }
            }
        }
    }
}