1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-07-16 21:51:12 +02:00

Rewording some exceptions messages

This commit is contained in:
MohannadNaj
2018-05-08 02:38:03 +03:00
parent 251ce11bdc
commit aa8846b944
2 changed files with 38 additions and 38 deletions

View File

@@ -98,7 +98,7 @@ class ZipFile implements ZipFileInterface
public function openFile($filename) public function openFile($filename)
{ {
if (!file_exists($filename)) { if (!file_exists($filename)) {
throw new InvalidArgumentException("File $filename can't exists."); throw new InvalidArgumentException("File $filename does not exist.");
} }
if (!($handle = @fopen($filename, 'rb'))) { if (!($handle = @fopen($filename, 'rb'))) {
throw new ZipException("File $filename can't open."); throw new ZipException("File $filename can't open.");
@@ -550,10 +550,10 @@ class ZipFile implements ZipFileInterface
{ {
$inputDir = (string)$inputDir; $inputDir = (string)$inputDir;
if (null === $inputDir || strlen($inputDir) === 0) { if (null === $inputDir || strlen($inputDir) === 0) {
throw new InvalidArgumentException('Input dir empty'); throw new InvalidArgumentException('The input directory is not specified');
} }
if (!is_dir($inputDir)) { if (!is_dir($inputDir)) {
throw new InvalidArgumentException('Directory ' . $inputDir . ' can\'t exists'); throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
} }
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR; $inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;
@@ -580,10 +580,10 @@ class ZipFile implements ZipFileInterface
{ {
$inputDir = (string)$inputDir; $inputDir = (string)$inputDir;
if (null === $inputDir || strlen($inputDir) === 0) { if (null === $inputDir || strlen($inputDir) === 0) {
throw new InvalidArgumentException('Input dir empty'); throw new InvalidArgumentException('The input directory is not specified');
} }
if (!is_dir($inputDir)) { if (!is_dir($inputDir)) {
throw new InvalidArgumentException('Directory ' . $inputDir . ' can\'t exists'); throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
} }
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR; $inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;
@@ -697,14 +697,14 @@ class ZipFile implements ZipFileInterface
) { ) {
$inputDir = (string)$inputDir; $inputDir = (string)$inputDir;
if (null === $inputDir || 0 === strlen($inputDir)) { if (null === $inputDir || 0 === strlen($inputDir)) {
throw new InvalidArgumentException('Input dir empty'); throw new InvalidArgumentException('The input directory is not specified');
} }
if (!is_dir($inputDir)) { if (!is_dir($inputDir)) {
throw new InvalidArgumentException('Directory ' . $inputDir . ' can\'t exists'); throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
} }
$globPattern = (string)$globPattern; $globPattern = (string)$globPattern;
if (empty($globPattern)) { if (empty($globPattern)) {
throw new InvalidArgumentException("glob pattern empty"); throw new InvalidArgumentException('The glob pattern is not specified');
} }
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR; $inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;
@@ -792,14 +792,14 @@ class ZipFile implements ZipFileInterface
) { ) {
$regexPattern = (string)$regexPattern; $regexPattern = (string)$regexPattern;
if (empty($regexPattern)) { if (empty($regexPattern)) {
throw new InvalidArgumentException("regex pattern empty"); throw new InvalidArgumentException('The regex pattern is not specified');
} }
$inputDir = (string)$inputDir; $inputDir = (string)$inputDir;
if (null === $inputDir || 0 === strlen($inputDir)) { if (null === $inputDir || 0 === strlen($inputDir)) {
throw new InvalidArgumentException('Input dir empty'); throw new InvalidArgumentException('The input directory is not specified');
} }
if (!is_dir($inputDir)) { if (!is_dir($inputDir)) {
throw new InvalidArgumentException('Directory ' . $inputDir . ' can\'t exists'); throw new InvalidArgumentException(sprintf('The "%s" directory does not exist.', $inputDir));
} }
$inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR; $inputDir = rtrim($inputDir, '/\\') . DIRECTORY_SEPARATOR;

View File

@@ -17,7 +17,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testOpenFileCantExists() public function testOpenFileCantExists()
{ {
@@ -1235,7 +1235,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddDirNullDirname() public function testAddDirNullDirname()
{ {
@@ -1245,7 +1245,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddDirEmptyDirname() public function testAddDirEmptyDirname()
{ {
@@ -1255,7 +1255,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testAddDirCantExists() public function testAddDirCantExists()
{ {
@@ -1265,7 +1265,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddDirRecursiveNullDirname() public function testAddDirRecursiveNullDirname()
{ {
@@ -1275,7 +1275,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddDirRecursiveEmptyDirname() public function testAddDirRecursiveEmptyDirname()
{ {
@@ -1285,7 +1285,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testAddDirRecursiveCantExists() public function testAddDirRecursiveCantExists()
{ {
@@ -1295,7 +1295,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromGlobNull() public function testAddFilesFromGlobNull()
{ {
@@ -1305,7 +1305,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromGlobEmpty() public function testAddFilesFromGlobEmpty()
{ {
@@ -1315,7 +1315,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testAddFilesFromGlobCantExists() public function testAddFilesFromGlobCantExists()
{ {
@@ -1325,7 +1325,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage glob pattern empty * @expectedExceptionMessage The glob pattern is not specified
*/ */
public function testAddFilesFromGlobNullPattern() public function testAddFilesFromGlobNullPattern()
{ {
@@ -1335,7 +1335,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage glob pattern empty * @expectedExceptionMessage The glob pattern is not specified
*/ */
public function testAddFilesFromGlobEmptyPattern() public function testAddFilesFromGlobEmptyPattern()
{ {
@@ -1345,7 +1345,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromGlobRecursiveNull() public function testAddFilesFromGlobRecursiveNull()
{ {
@@ -1355,7 +1355,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromGlobRecursiveEmpty() public function testAddFilesFromGlobRecursiveEmpty()
{ {
@@ -1365,7 +1365,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testAddFilesFromGlobRecursiveCantExists() public function testAddFilesFromGlobRecursiveCantExists()
{ {
@@ -1375,7 +1375,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage glob pattern empty * @expectedExceptionMessage The glob pattern is not specified
*/ */
public function testAddFilesFromGlobRecursiveNullPattern() public function testAddFilesFromGlobRecursiveNullPattern()
{ {
@@ -1385,7 +1385,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage glob pattern empty * @expectedExceptionMessage The glob pattern is not specified
*/ */
public function testAddFilesFromGlobRecursiveEmptyPattern() public function testAddFilesFromGlobRecursiveEmptyPattern()
{ {
@@ -1395,7 +1395,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromRegexDirectoryNull() public function testAddFilesFromRegexDirectoryNull()
{ {
@@ -1405,7 +1405,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromRegexDirectoryEmpty() public function testAddFilesFromRegexDirectoryEmpty()
{ {
@@ -1415,7 +1415,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testAddFilesFromRegexCantExists() public function testAddFilesFromRegexCantExists()
{ {
@@ -1425,7 +1425,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage regex pattern empty * @expectedExceptionMessage The regex pattern is not specified
*/ */
public function testAddFilesFromRegexNullPattern() public function testAddFilesFromRegexNullPattern()
{ {
@@ -1435,7 +1435,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage regex pattern empty * @expectedExceptionMessage The regex pattern is not specified
*/ */
public function testAddFilesFromRegexEmptyPattern() public function testAddFilesFromRegexEmptyPattern()
{ {
@@ -1445,7 +1445,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromRegexRecursiveDirectoryNull() public function testAddFilesFromRegexRecursiveDirectoryNull()
{ {
@@ -1455,7 +1455,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage Input dir empty * @expectedExceptionMessage The input directory is not specified
*/ */
public function testAddFilesFromRegexRecursiveEmpty() public function testAddFilesFromRegexRecursiveEmpty()
{ {
@@ -1465,7 +1465,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage can't exists * @expectedExceptionMessage does not exist
*/ */
public function testAddFilesFromRegexRecursiveCantExists() public function testAddFilesFromRegexRecursiveCantExists()
{ {
@@ -1475,7 +1475,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage regex pattern empty * @expectedExceptionMessage The regex pattern is not specified
*/ */
public function testAddFilesFromRegexRecursiveNullPattern() public function testAddFilesFromRegexRecursiveNullPattern()
{ {
@@ -1485,7 +1485,7 @@ class ZipFileTest extends ZipTestCase
/** /**
* @expectedException \PhpZip\Exception\InvalidArgumentException * @expectedException \PhpZip\Exception\InvalidArgumentException
* @expectedExceptionMessage regex pattern empty * @expectedExceptionMessage The regex pattern is not specified
*/ */
public function testAddFilesFromRegexRecursiveEmptyPattern() public function testAddFilesFromRegexRecursiveEmptyPattern()
{ {