diff --git a/src/ApiManager.php b/src/ApiManager.php index cd58b6c..2d6316b 100644 --- a/src/ApiManager.php +++ b/src/ApiManager.php @@ -23,6 +23,7 @@ use Psr\Cache\CacheItemPoolInterface; use PSX\Api\Builder\SpecificationBuilder; use PSX\Api\Builder\SpecificationBuilderInterface; +use PSX\Api\Exception\ApiException; use PSX\Api\Exception\InvalidApiException; use PSX\Api\Parser\Attribute\BuilderInterface; use PSX\Schema\Parser\ContextInterface; @@ -41,6 +42,9 @@ class ApiManager implements ApiManagerInterface private CacheItemPoolInterface $cache; private bool $debug; + /** + * @var array + */ private array $parsers = []; public function __construct(SchemaManagerInterface $schemaManager, BuilderInterface $builder, ?CacheItemPoolInterface $cache = null, bool $debug = false) @@ -59,6 +63,9 @@ public function register(string $scheme, ParserInterface $parser): void $this->parsers[$scheme] = $parser; } + /** + * @throws ApiException + */ public function getApi(string $source, ?ContextInterface $context = null): SpecificationInterface { $item = null; diff --git a/src/Exception/ApiException.php b/src/Exception/ApiException.php new file mode 100644 index 0000000..dc20905 --- /dev/null +++ b/src/Exception/ApiException.php @@ -0,0 +1,32 @@ + + * + * Copyright (c) Christoph Kappestein + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace PSX\Api\Exception; + +/** + * ApiException + * + * @author Christoph Kappestein + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @link https://phpsx.org + */ +class ApiException extends \Exception +{ +} diff --git a/src/Exception/ArgumentNotFoundException.php b/src/Exception/ArgumentNotFoundException.php index d5c21c3..28d81d7 100644 --- a/src/Exception/ArgumentNotFoundException.php +++ b/src/Exception/ArgumentNotFoundException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class ArgumentNotFoundException extends \Exception +class ArgumentNotFoundException extends ApiException { } diff --git a/src/Exception/GeneratorException.php b/src/Exception/GeneratorException.php index f10f79f..552f7b0 100644 --- a/src/Exception/GeneratorException.php +++ b/src/Exception/GeneratorException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class GeneratorException extends \Exception +class GeneratorException extends ApiException { } diff --git a/src/Exception/InvalidApiException.php b/src/Exception/InvalidApiException.php index 5cd526d..df07512 100644 --- a/src/Exception/InvalidApiException.php +++ b/src/Exception/InvalidApiException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class InvalidApiException extends \Exception +class InvalidApiException extends ApiException { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 3ff839e..fe03117 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class InvalidArgumentException extends \Exception +class InvalidArgumentException extends ApiException { } diff --git a/src/Exception/InvalidMethodException.php b/src/Exception/InvalidMethodException.php index e31129e..84c7a99 100644 --- a/src/Exception/InvalidMethodException.php +++ b/src/Exception/InvalidMethodException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class InvalidMethodException extends \Exception +class InvalidMethodException extends ApiException { } diff --git a/src/Exception/InvalidOperationException.php b/src/Exception/InvalidOperationException.php index 913f119..afbd956 100644 --- a/src/Exception/InvalidOperationException.php +++ b/src/Exception/InvalidOperationException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class InvalidOperationException extends \Exception +class InvalidOperationException extends ApiException { } diff --git a/src/Exception/InvalidTypeException.php b/src/Exception/InvalidTypeException.php index ba17bed..f65bbd9 100644 --- a/src/Exception/InvalidTypeException.php +++ b/src/Exception/InvalidTypeException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class InvalidTypeException extends \Exception +class InvalidTypeException extends ApiException { } diff --git a/src/Exception/OperationAlreadyExistsException.php b/src/Exception/OperationAlreadyExistsException.php index 3d0ef98..317d508 100644 --- a/src/Exception/OperationAlreadyExistsException.php +++ b/src/Exception/OperationAlreadyExistsException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class OperationAlreadyExistsException extends \Exception +class OperationAlreadyExistsException extends ApiException { } diff --git a/src/Exception/OperationNotFoundException.php b/src/Exception/OperationNotFoundException.php index 43e39c7..18bb851 100644 --- a/src/Exception/OperationNotFoundException.php +++ b/src/Exception/OperationNotFoundException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class OperationNotFoundException extends \Exception +class OperationNotFoundException extends ApiException { } diff --git a/src/Exception/ParserException.php b/src/Exception/ParserException.php index 17bdf45..68d55ce 100644 --- a/src/Exception/ParserException.php +++ b/src/Exception/ParserException.php @@ -27,6 +27,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 * @link https://phpsx.org */ -class ParserException extends \Exception +class ParserException extends ApiException { }