src/Core/Folder.php
public function createFolderIfNotExists($folderPath) {
        if (file_exists($folderPath) && is_dir($folderPath)) {
            return;
        }
        
        $arrFolder = explode(DIRECTORY_SEPARATOR, $folderPath);
        
        $fullPath = "";
        $first = true;
        foreach ($arrFolder as $folder) {
            if (!$folder) {
                continue; //Happens if the first char is a slash
            }
            if (!$first) {
                $fullPath .= DIRECTORY_SEPARATOR;
            } else {
                $first = false;
            }
            
            $fullPath .= $folder;
            
            try {
                $this->createSingleFolderIfNotExists($fullPath);
            } catch (Exception $e) {
                $msg = $e->getMessage();
                echo "Could not generate folder '".$fullPath."' <br />\n"
                        . $msg
                        . "<br />";
            }
        }        
    }
public function createFolderIfNotExists($folderPath) {
        if (file_exists($folderPath) && is_dir($folderPath)) {
            return;
        }
        
        $arrFolder = explode(DIRECTORY_SEPARATOR, $folderPath);
        
        $fullPath = "";
        $first = true;
        foreach ($arrFolder as $folder) {
            if (!$folder) {
                continue; //Happens if the first char is a slash
            }
            if (!$first) {
                $fullPath .= DIRECTORY_SEPARATOR;
            } else {
                $first = false;
            }
            
            $fullPath .= $folder;
            
            try {
                $this->createSingleFolderIfNotExists($fullPath);
            } catch (Exception $e) {
                $msg = $e->getMessage();
                echo "Could not generate folder '".$fullPath."' <br />\n"
                        . $msg
                        . "<br />";
            }
        }        
    }
public function createFolderIfNotExists ( $ folderPath ) { if ( file_exists ( $ folderPath ) && is_dir ( $ folderPath ) ) { return ; } $ arrFolder = explode ( DIRECTORY_SEPARATOR , $ folderPath ) ; $ fullPath = "" ; $ first = true ; foreach ( $ arrFolder as $ folder ) { if ( ! $ folder ) { continue ; //Happens if the first char is a slash } if ( ! $ first ) { $ fullPath .= DIRECTORY_SEPARATOR ; } else { $ first = false ; } $ fullPath .= $ folder ; try { $ this -> createSingleFolderIfNotExists ( $ fullPath ) ; } catch ( Exception $ e ) { $ msg = $ e -> getMessage ( ) ; echo "Could not generate folder '" . $ fullPath . "' <br />\n" . $ msg . "<br />" ; } } }
Creates a full folder path

@param string $folderPath
@return void
Creates a full folder path