code: static public function dir($directory, $date = false)
      {
          if ($date) {
              $directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . self::getDateDirectory();
          }
  
          if (!is_dir($directory)) {
              $umask = umask(0000);
              if (@mkdir($directory, 0777, true) === false) {
                  throw new Exception(sprintf('Directory "%s" cannot be created.', $directory));
              }
              umask($umask);
          }
  
          return $directory;
      }
docs: Method create directory if not exist
  
  @param string $directory
  @param boolean $date
  @return string
  @throws \Extlib\Exception