original_string: public static function initMaildir($dir)
      {
          if (file_exists($dir)) {
              if (!is_dir($dir)) {
                  /**
                   * @see Zend_Mail_Storage_Exception
                   */
                  // require_once 'Zend/Mail/Storage/Exception.php';
                  throw new Zend_Mail_Storage_Exception('maildir must be a directory if already exists');
              }
          } else {
              if (!mkdir($dir)) {
                  /**
                   * @see Zend_Mail_Storage_Exception
                   */
                  // require_once 'Zend/Mail/Storage/Exception.php';
                  $dir = dirname($dir);
                  if (!file_exists($dir)) {
                      throw new Zend_Mail_Storage_Exception("parent $dir not found");
                  } else if (!is_dir($dir)) {
                      throw new Zend_Mail_Storage_Exception("parent $dir not a directory");
                  } else {
                      throw new Zend_Mail_Storage_Exception('cannot create maildir');
                  }
              }
          }
  
          foreach (array('cur', 'tmp', 'new') as $subdir) {
              if (!@mkdir($dir . DIRECTORY_SEPARATOR . $subdir)) {
                  // ignore if dir exists (i.e. was already valid maildir or two processes try to create one)
                  if (!file_exists($dir . DIRECTORY_SEPARATOR . $subdir)) {
                      /**
                       * @see Zend_Mail_Storage_Exception
                       */
                      // require_once 'Zend/Mail/Storage/Exception.php';
                      throw new Zend_Mail_Storage_Exception('could not create subdir ' . $subdir);
                  }
              }
          }
      }
code: public static function initMaildir($dir)
      {
          if (file_exists($dir)) {
              if (!is_dir($dir)) {
                  /**
                   * @see Zend_Mail_Storage_Exception
                   */
                  // require_once 'Zend/Mail/Storage/Exception.php';
                  throw new Zend_Mail_Storage_Exception('maildir must be a directory if already exists');
              }
          } else {
              if (!mkdir($dir)) {
                  /**
                   * @see Zend_Mail_Storage_Exception
                   */
                  // require_once 'Zend/Mail/Storage/Exception.php';
                  $dir = dirname($dir);
                  if (!file_exists($dir)) {
                      throw new Zend_Mail_Storage_Exception("parent $dir not found");
                  } else if (!is_dir($dir)) {
                      throw new Zend_Mail_Storage_Exception("parent $dir not a directory");
                  } else {
                      throw new Zend_Mail_Storage_Exception('cannot create maildir');
                  }
              }
          }
  
          foreach (array('cur', 'tmp', 'new') as $subdir) {
              if (!@mkdir($dir . DIRECTORY_SEPARATOR . $subdir)) {
                  // ignore if dir exists (i.e. was already valid maildir or two processes try to create one)
                  if (!file_exists($dir . DIRECTORY_SEPARATOR . $subdir)) {
                      /**
                       * @see Zend_Mail_Storage_Exception
                       */
                      // require_once 'Zend/Mail/Storage/Exception.php';
                      throw new Zend_Mail_Storage_Exception('could not create subdir ' . $subdir);
                  }
              }
          }
      }
code_tokens: public static function initMaildir ( $ dir ) { if ( file_exists ( $ dir ) ) { if ( ! is_dir ( $ dir ) ) { /**
                   * @see Zend_Mail_Storage_Exception
                   */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception ( 'maildir must be a directory if already exists' ) ; } } else { if ( ! mkdir ( $ dir ) ) { /**
                   * @see Zend_Mail_Storage_Exception
                   */ // require_once 'Zend/Mail/Storage/Exception.php'; $ dir = dirname ( $ dir ) ; if ( ! file_exists ( $ dir ) ) { throw new Zend_Mail_Storage_Exception ( "parent $dir not found" ) ; } else if ( ! is_dir ( $ dir ) ) { throw new Zend_Mail_Storage_Exception ( "parent $dir not a directory" ) ; } else { throw new Zend_Mail_Storage_Exception ( 'cannot create maildir' ) ; } } } foreach ( array ( 'cur' , 'tmp' , 'new' ) as $ subdir ) { if ( ! @ mkdir ( $ dir . DIRECTORY_SEPARATOR . $ subdir ) ) { // ignore if dir exists (i.e. was already valid maildir or two processes try to create one) if ( ! file_exists ( $ dir . DIRECTORY_SEPARATOR . $ subdir ) ) { /**
                       * @see Zend_Mail_Storage_Exception
                       */ // require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception ( 'could not create subdir ' . $ subdir ) ; } } } }
docstring: create a new maildir
  
  If the given dir is already a valid maildir this will not fail.
  
  @param string $dir directory for the new maildir (may already exist)
  @return null
  @throws Zend_Mail_Storage_Exception
docstring_tokens: create a new maildir