Library/Console/Command/InitCommand.php
private function recursiveProcess($src, $dst, $pattern = null, $callback = 'copy')
    {
        $success = true;
        $iterator = new \DirectoryIterator($src);

        foreach ($iterator as $item) {
            $pathName = $item->getPathname();
            if (!is_readable($pathName)) {
                $this->logger->error('File is not readable :'.$pathName);
                continue;
            }

            $fileName = $item->getFileName();

            if ($item->isDir()) {
                if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) {
                    if (!is_dir($dst.\DIRECTORY_SEPARATOR.$fileName)) {
                        mkdir($dst.\DIRECTORY_SEPARATOR.$fileName, 0755, true);
                    }
                    $this->recursiveProcess($pathName, $dst.\DIRECTORY_SEPARATOR.$fileName, $pattern, $callback);
                }
            } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) {
                $path = $dst.\DIRECTORY_SEPARATOR.$fileName;
                $success = $success && \call_user_func($callback, $pathName, $path);
            }
        }

        return $success;
    }
private function recursiveProcess($src, $dst, $pattern = null, $callback = 'copy')
    {
        $success = true;
        $iterator = new \DirectoryIterator($src);

        foreach ($iterator as $item) {
            $pathName = $item->getPathname();
            if (!is_readable($pathName)) {
                $this->logger->error('File is not readable :'.$pathName);
                continue;
            }

            $fileName = $item->getFileName();

            if ($item->isDir()) {
                if ('.' != $fileName && '..' != $fileName && '.libs' != $fileName) {
                    if (!is_dir($dst.\DIRECTORY_SEPARATOR.$fileName)) {
                        mkdir($dst.\DIRECTORY_SEPARATOR.$fileName, 0755, true);
                    }
                    $this->recursiveProcess($pathName, $dst.\DIRECTORY_SEPARATOR.$fileName, $pattern, $callback);
                }
            } elseif (!$pattern || ($pattern && 1 === preg_match($pattern, $fileName))) {
                $path = $dst.\DIRECTORY_SEPARATOR.$fileName;
                $success = $success && \call_user_func($callback, $pathName, $path);
            }
        }

        return $success;
    }
private function recursiveProcess ( $ src , $ dst , $ pattern = null , $ callback = 'copy' ) { $ success = true ; $ iterator = new \ DirectoryIterator ( $ src ) ; foreach ( $ iterator as $ item ) { $ pathName = $ item -> getPathname ( ) ; if ( ! is_readable ( $ pathName ) ) { $ this -> logger -> error ( 'File is not readable :' . $ pathName ) ; continue ; } $ fileName = $ item -> getFileName ( ) ; if ( $ item -> isDir ( ) ) { if ( '.' != $ fileName && '..' != $ fileName && '.libs' != $ fileName ) { if ( ! is_dir ( $ dst . \ DIRECTORY_SEPARATOR . $ fileName ) ) { mkdir ( $ dst . \ DIRECTORY_SEPARATOR . $ fileName , 0755 , true ) ; } $ this -> recursiveProcess ( $ pathName , $ dst . \ DIRECTORY_SEPARATOR . $ fileName , $ pattern , $ callback ) ; } } elseif ( ! $ pattern || ( $ pattern && 1 === preg_match ( $ pattern , $ fileName ) ) ) { $ path = $ dst . \ DIRECTORY_SEPARATOR . $ fileName ; $ success = $ success && \ call_user_func ( $ callback , $ pathName , $ path ) ; } } return $ success ; }
Copies the base kernel to the extension destination.

@param $src
@param $dst
@param string $pattern
@param mixed  $callback

@return bool
Copies the base kernel to the extension destination .