public static function Create( string $folder, int $mode = 0700 )
   {

      if ( \is_dir( $folder ) )
      {
         // No folder = do nothing
         return;
      }

      if ( ! static::CanCreate( $folder ) )
      {
         // No rights to create the required folder
         throw new FolderAccessError(
            'IO',
            $folder,
            FolderAccessError::ACCESS_CREATE,
            'Creation of folder fails cause base folder is not writable!'
         );
      }

      try
      {
         if ( \DIRECTORY_SEPARATOR == '\\' )
         {
            // Windows = do not use the mode
            $res = \mkdir( $folder, null, true );
         }
         else
         {
            // All other use the mode flag
            $res = \mkdir( $folder, $mode, true );
         }
      }
      catch ( \Throwable $ex )
      {
         // Folder creation fails
         throw new FolderAccessError(
            'IO',
            $folder,
            FolderAccessError::ACCESS_CREATE,
            'Creation of folder fails cause base folder is not writable!',
            \E_USER_ERROR,
            $ex
         );
      }

      if ( ! $res || ! \is_dir( $folder ) )
      {
         // Folder creation fails
         throw new FolderAccessError(
            'IO',
            $folder,
            FolderAccessError::ACCESS_CREATE,
            'Unknown error while executing folder creation.'
         );
      }

      \clearstatcache();

   }
public static function Create( string $folder, int $mode = 0700 )
   {

      if ( \is_dir( $folder ) )
      {
         // No folder = do nothing
         return;
      }

      if ( ! static::CanCreate( $folder ) )
      {
         // No rights to create the required folder
         throw new FolderAccessError(
            'IO',
            $folder,
            FolderAccessError::ACCESS_CREATE,
            'Creation of folder fails cause base folder is not writable!'
         );
      }

      try
      {
         if ( \DIRECTORY_SEPARATOR == '\\' )
         {
            // Windows = do not use the mode
            $res = \mkdir( $folder, null, true );
         }
         else
         {
            // All other use the mode flag
            $res = \mkdir( $folder, $mode, true );
         }
      }
      catch ( \Throwable $ex )
      {
         // Folder creation fails
         throw new FolderAccessError(
            'IO',
            $folder,
            FolderAccessError::ACCESS_CREATE,
            'Creation of folder fails cause base folder is not writable!',
            \E_USER_ERROR,
            $ex
         );
      }

      if ( ! $res || ! \is_dir( $folder ) )
      {
         // Folder creation fails
         throw new FolderAccessError(
            'IO',
            $folder,
            FolderAccessError::ACCESS_CREATE,
            'Unknown error while executing folder creation.'
         );
      }

      \clearstatcache();

   }
public static function Create ( string $ folder , int $ mode = 0700 ) { if ( \ is_dir ( $ folder ) ) { // No folder = do nothing return ; } if ( ! static :: CanCreate ( $ folder ) ) { // No rights to create the required folder throw new FolderAccessError ( 'IO' , $ folder , FolderAccessError :: ACCESS_CREATE , 'Creation of folder fails cause base folder is not writable!' ) ; } try { if ( \ DIRECTORY_SEPARATOR == '\\' ) { // Windows = do not use the mode $ res = \ mkdir ( $ folder , null , true ) ; } else { // All other use the mode flag $ res = \ mkdir ( $ folder , $ mode , true ) ; } } catch ( \ Throwable $ ex ) { // Folder creation fails throw new FolderAccessError ( 'IO' , $ folder , FolderAccessError :: ACCESS_CREATE , 'Creation of folder fails cause base folder is not writable!' , \ E_USER_ERROR , $ ex ) ; } if ( ! $ res || ! \ is_dir ( $ folder ) ) { // Folder creation fails throw new FolderAccessError ( 'IO' , $ folder , FolderAccessError :: ACCESS_CREATE , 'Unknown error while executing folder creation.' ) ; } \ clearstatcache ( ) ; }
Creates a new folder with defined mode. The mode only works on unixoid systems.

@param  string  $folder The folder to create.
@param  integer $mode Mode for new folder (0700) only used for unixoide systems
@throws \Beluga\IO\FolderAccessError If creation fails
Creates a new folder with defined mode . The mode only works on unixoid systems .