* @license MIT */ class FileNotWritableException extends UnexpectedValueException implements ExceptionInterface { /** * @param string $fromPath * @param string $toPath * * @return self */ public static function fromInvalidMoveOperation($fromPath, $toPath) { return new self(sprintf( 'Could not move file "%s" to location "%s": ' . 'either the source file is not readable, or the destination is not writable', $fromPath, $toPath )); } /** * @param string $path * * @return self */ public static function fromNonWritableLocation($path) { $messages = array(); if (($destination = realpath($path)) && ! is_file($destination)) { $messages[] = 'exists and is not a file'; } if (! is_writable($destination)) { $messages[] = 'is not writable'; } return new self(sprintf('Could not write to path "%s": %s', $path, implode(', ', $messages))); } }