forked from PHPOffice/PHPPresentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPOffice#634 : Set specific exceptions
- Loading branch information
Showing
103 changed files
with
1,220 additions
and
1,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/PhpPresentation/Exception/DirectoryNotFoundException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class DirectoryNotFoundException extends PhpPresentationException | ||
{ | ||
public function __construct(string $path) | ||
{ | ||
parent::__construct(sprintf( | ||
'The directory %s doesn\'t exist', | ||
$path | ||
)); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/PhpPresentation/Exception/FeatureNotImplementedException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class FeatureNotImplementedException extends PhpPresentationException | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct('The feature is not implemented. Please create an issue.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class FileCopyException extends PhpPresentationException | ||
{ | ||
public function __construct(string $source, string $destination) | ||
{ | ||
parent::__construct(sprintf( | ||
'The file %s can\'t be copied to %s', | ||
$source, | ||
$destination | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class FileNotFoundException extends PhpPresentationException | ||
{ | ||
public function __construct(string $path) | ||
{ | ||
parent::__construct(sprintf( | ||
'The file "%s" doesn\'t exist', | ||
$path | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class FileRemoveException extends PhpPresentationException | ||
{ | ||
public function __construct(string $path) | ||
{ | ||
parent::__construct(sprintf( | ||
'The file %s can\'t be removed', | ||
$path | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class InvalidClassException extends PhpPresentationException | ||
{ | ||
public function __construct(string $class, string $error) | ||
{ | ||
parent::__construct(sprintf( | ||
'The class %s is invalid (%s)', | ||
$class, | ||
$error | ||
)); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/PhpPresentation/Exception/InvalidFileFormatException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class InvalidFileFormatException extends PhpPresentationException | ||
{ | ||
public function __construct(string $path, string $class, string $error = '') | ||
{ | ||
if ($class) { | ||
$class = 'class ' . $class; | ||
} | ||
if ($error) { | ||
$error = '(' . $error . ')'; | ||
} | ||
|
||
parent::__construct(sprintf( | ||
'The file %s is not in the format supported by %s%s%s', | ||
$path, | ||
$class, | ||
!empty($error) ? ' ' : '', | ||
$error | ||
)); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/PhpPresentation/Exception/InvalidParameterException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class InvalidParameterException extends PhpPresentationException | ||
{ | ||
public function __construct(string $parameter, string $value) | ||
{ | ||
parent::__construct(sprintf( | ||
'The parameter %s can\'t have the value "%s"', | ||
$parameter, | ||
$value | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
class OutOfBoundsException extends PhpPresentationException | ||
{ | ||
public function __construct(int $minBounds, ?int $maxBounds, int $expectedBounds) | ||
{ | ||
parent::__construct(sprintf( | ||
'The expected value (%d) is out of bounds (%d, %s)', | ||
$expectedBounds, | ||
$minBounds, | ||
$maxBounds ?? 'Infinite' | ||
)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/PhpPresentation/Exception/PhpPresentationException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* This file is part of PHPPresentation - A pure PHP library for reading and writing | ||
* presentations documents. | ||
* | ||
* PHPPresentation is free software distributed under the terms of the GNU Lesser | ||
* General Public License version 3 as published by the Free Software Foundation. | ||
* | ||
* For the full copyright and license information, please read the LICENSE | ||
* file that was distributed with this source code. For the full list of | ||
* contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors. | ||
* | ||
* @see https://github.com/PHPOffice/PHPPresentation | ||
* | ||
* @copyright 2009-2015 PHPPresentation contributors | ||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpPresentation\Exception; | ||
|
||
use Exception; | ||
|
||
class PhpPresentationException extends Exception | ||
{ | ||
} |
Oops, something went wrong.