mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-04 01:34:07 +02:00
require php5.6+
This commit is contained in:
parent
f258947a6f
commit
0cbfd0872d
5 changed files with 47 additions and 37 deletions
|
|
@ -13,6 +13,7 @@ use Icewind\SMB\Exception\AuthenticationException;
|
|||
use Icewind\SMB\Exception\Exception;
|
||||
use Icewind\SMB\Exception\FileInUseException;
|
||||
use Icewind\SMB\Exception\InvalidHostException;
|
||||
use Icewind\SMB\Exception\InvalidParameterException;
|
||||
use Icewind\SMB\Exception\InvalidResourceException;
|
||||
use Icewind\SMB\Exception\InvalidTypeException;
|
||||
use Icewind\SMB\Exception\NoLoginServerException;
|
||||
|
|
@ -29,18 +30,18 @@ class Parser {
|
|||
|
||||
// todo replace with static once <5.6 support is dropped
|
||||
// see error.h
|
||||
private static $exceptionMap = [
|
||||
ErrorCodes::LogonFailure => '\Icewind\SMB\Exception\AuthenticationException',
|
||||
ErrorCodes::PathNotFound => '\Icewind\SMB\Exception\NotFoundException',
|
||||
ErrorCodes::ObjectNotFound => '\Icewind\SMB\Exception\NotFoundException',
|
||||
ErrorCodes::NoSuchFile => '\Icewind\SMB\Exception\NotFoundException',
|
||||
ErrorCodes::NameCollision => '\Icewind\SMB\Exception\AlreadyExistsException',
|
||||
ErrorCodes::AccessDenied => '\Icewind\SMB\Exception\AccessDeniedException',
|
||||
ErrorCodes::DirectoryNotEmpty => '\Icewind\SMB\Exception\NotEmptyException',
|
||||
ErrorCodes::FileIsADirectory => '\Icewind\SMB\Exception\InvalidTypeException',
|
||||
ErrorCodes::NotADirectory => '\Icewind\SMB\Exception\InvalidTypeException',
|
||||
ErrorCodes::SharingViolation => '\Icewind\SMB\Exception\FileInUseException',
|
||||
ErrorCodes::InvalidParameter => '\Icewind\SMB\Exception\InvalidParameterException'
|
||||
const EXCEPTION_MAP = [
|
||||
ErrorCodes::LogonFailure => AuthenticationException::class,
|
||||
ErrorCodes::PathNotFound => NotFoundException::class,
|
||||
ErrorCodes::ObjectNotFound => NotFoundException::class,
|
||||
ErrorCodes::NoSuchFile => NotFoundException::class,
|
||||
ErrorCodes::NameCollision => AlreadyExistsException::class,
|
||||
ErrorCodes::AccessDenied => AccessDeniedException::class,
|
||||
ErrorCodes::DirectoryNotEmpty => NotEmptyException::class,
|
||||
ErrorCodes::FileIsADirectory => InvalidTypeException::class,
|
||||
ErrorCodes::NotADirectory => InvalidTypeException::class,
|
||||
ErrorCodes::SharingViolation => FileInUseException::class,
|
||||
ErrorCodes::InvalidParameter => InvalidParameterException::class
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +72,7 @@ class Parser {
|
|||
throw new InvalidResourceException('Failed opening local file "' . $localPath . '" for writing');
|
||||
}
|
||||
|
||||
throw Exception::fromMap(self::$exceptionMap, $error, $path);
|
||||
throw Exception::fromMap(self::EXCEPTION_MAP, $error, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue