Code Style and documentation
This commit is contained in:
@ -2,15 +2,26 @@
|
||||
|
||||
class Helper
|
||||
{
|
||||
/**
|
||||
* Copy all files from $path to $local_base
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $local_base
|
||||
*/
|
||||
public static function copyAssets($path, $local_base)
|
||||
{
|
||||
@mkdir($path);
|
||||
mkdir($path);
|
||||
static::rmdir($path);
|
||||
|
||||
@mkdir($path . DS . 'resources');
|
||||
mkdir($path . DS . 'resources');
|
||||
static::copyRecursive($local_base . DS . 'resources', $path . DS . 'resources');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a directory recursively
|
||||
*
|
||||
* @param string $dir
|
||||
*/
|
||||
private static function rmdir($dir)
|
||||
{
|
||||
$it = new \RecursiveDirectoryIterator($dir);
|
||||
@ -27,16 +38,22 @@ class Helper
|
||||
}
|
||||
}
|
||||
|
||||
private static function copyRecursive($src, $dst)
|
||||
/**
|
||||
* Copy files recursively
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $destination
|
||||
*/
|
||||
private static function copyRecursive($source, $destination)
|
||||
{
|
||||
$dir = opendir($src);
|
||||
@mkdir($dst);
|
||||
while (false !== ( $file = readdir($dir))) {
|
||||
if (( $file != '.' ) && ( $file != '..' )) {
|
||||
if (is_dir($src . '/' . $file)) {
|
||||
static::copyRecursive($src . '/' . $file, $dst . '/' . $file);
|
||||
$dir = opendir($source);
|
||||
mkdir($destination);
|
||||
while (false !== ($file = readdir($dir))) {
|
||||
if ($file != '.' && $file != '..') {
|
||||
if (is_dir($source . '/' . $file)) {
|
||||
static::copyRecursive($source . '/' . $file, $destination . '/' . $file);
|
||||
} else {
|
||||
copy($src . '/' . $file, $dst . '/' . $file);
|
||||
copy($source . '/' . $file, $destination . '/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user