public static function writeTemplates($subDirOrFile = '', bool $recursive = true) { if (!is_array($subDirOrFile)) { $subDirOrFile = [$subDirOrFile]; } foreach ($subDirOrFile as $_subDirOrFile) { $target = self::$templateDir . "/" . $_subDirOrFile; if (is_dir($target)) { $files = YorgDirScannerTool::getFilesWithExtension($target, self::$templateExtension, false, $recursive); foreach ($files as $file) { self::printTarget($file); } } elseif (is_file($target)) { self::printTarget($target); } else { trigger_error("Target not found: {$target}"); } } }
<?php use DirScanner\YorgDirScannerTool; use MikeMagicTools\File\MikeFileStripLinesTool; require_once "bigbang.php"; // start the local universe //------------------------------------------------------------------------------/ // CONFIG //------------------------------------------------------------------------------/ $dir = "/path/to/app/www/libs"; //------------------------------------------------------------------------------/ // SCRIPT //------------------------------------------------------------------------------/ $files = YorgDirScannerTool::getFilesWithExtension($dir, 'js', false, true); a($files); MikeFileStripLinesTool::strip($files, 'lingosiris');