public function testIsSubpath() { $folder = Bootstrap::getRandString(); $subfolder = Bootstrap::getRandString(); $path = __DIR__ . DIRECTORY_SEPARATOR . $folder; $subpath = $path . DIRECTORY_SEPARATOR . $subfolder; $create = mkdir($path); $this->assertTrue($create); $create2 = mkdir($subpath); $this->assertTrue($create2); $res = DirectoryUtils::isSubpath($path, $subpath); $this->assertTrue($res); $deleted = rmdir($subpath); $this->assertTrue($deleted); $deleted2 = rmdir($path); $this->assertTrue($deleted2); }
private function searchAssets($path, $extension, array $excludes = null) { $assets = array(); $assetPath = realpath($path . DIRECTORY_SEPARATOR . 'fixed'); if (is_dir($assetPath)) { $assets = Directory::recursiveSearchByExtension($assetPath, $extension, $excludes); } return $assets; }
/** * Generate the collections of assets for the a template. * @param string $extension * @return array|Traversable collections of assets */ public function generateCollection($paths, $extension) { $ret = array(); foreach ($paths as $path) { if (!is_dir($path)) { continue; } $files = DirectoryUtils::recursiveSearchByExtension($path, $extension); $ret = array_merge($ret, $files); } sort($ret); return $ret; }
/** * Searchs for assets inside the template path * * @param string $extension * @return Array */ public function searchAssets($extension, array $excludes = null) { $path = $this->getPath(); return DirectoryUtils::recursiveSearchByExtension($path, $extension, $excludes); }