[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/ -> FileNotWritableException.php (source)

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  namespace ProxyManager\Exception;
   6  
   7  use UnexpectedValueException;
   8  
   9  /**
  10   * Exception for non writable files
  11   *
  12   * @author Marco Pivetta <ocramius@gmail.com>
  13   * @license MIT
  14   */
  15  class FileNotWritableException extends UnexpectedValueException implements ExceptionInterface
  16  {
  17      public static function fromInvalidMoveOperation(string $fromPath, string $toPath) : self
  18      {
  19          return new self(sprintf(
  20              'Could not move file "%s" to location "%s": '
  21              . 'either the source file is not readable, or the destination is not writable',
  22              $fromPath,
  23              $toPath
  24          ));
  25      }
  26  
  27      /**
  28       * @deprecated this method is unused, and will be removed in ProxyManager 3.0.0
  29       */
  30      public static function fromNonWritableLocation($path) : self
  31      {
  32          $messages    = [];
  33          $destination = realpath($path);
  34  
  35          if (! $destination) {
  36              $messages[] = 'path does not exist';
  37          }
  38  
  39          if ($destination && ! is_file($destination)) {
  40              $messages[] = 'exists and is not a file';
  41          }
  42  
  43          if ($destination && ! is_writable($destination)) {
  44              $messages[] = 'is not writable';
  45          }
  46  
  47          return new self(sprintf('Could not write to path "%s": %s', $path, implode(', ', $messages)));
  48      }
  49  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1