[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/laminas/laminas-diactoros/src/Exception/ -> UploadedFileErrorException.php (source)

   1  <?php
   2  
   3  /**
   4   * @see       https://github.com/laminas/laminas-diactoros for the canonical source repository
   5   * @copyright https://github.com/laminas/laminas-diactoros/blob/master/COPYRIGHT.md
   6   * @license   https://github.com/laminas/laminas-diactoros/blob/master/LICENSE.md New BSD License
   7   */
   8  
   9  declare(strict_types=1);
  10  
  11  namespace Laminas\Diactoros\Exception;
  12  
  13  use RuntimeException;
  14  
  15  use function sprintf;
  16  
  17  class UploadedFileErrorException extends RuntimeException implements ExceptionInterface
  18  {
  19      public static function forUnmovableFile() : self
  20      {
  21          return new self('Error occurred while moving uploaded file');
  22      }
  23  
  24      public static function dueToStreamUploadError(string $error) : self
  25      {
  26          return new self(sprintf(
  27              'Cannot retrieve stream due to upload error: %s',
  28              $error
  29          ));
  30      }
  31  
  32      public static function dueToUnwritablePath() : self
  33      {
  34          return new self('Unable to write to designated path');
  35      }
  36  
  37      public static function dueToUnwritableTarget(string $targetDirectory) : self
  38      {
  39          return new self(sprintf(
  40              'The target directory `%s` does not exists or is not writable',
  41              $targetDirectory
  42          ));
  43      }
  44  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer