Skip to content

Exceptions #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
tests/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
CONTRIBUTING.md export-ignore
phpunit.xml.dist export-ignore
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
build/
vendor/
composer.lock
phpunit.xml
8 changes: 0 additions & 8 deletions .scrutinizer.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

[![Latest Version](https://img.shields.io/github/release/php-http/adapter.svg?style=flat-square)](https://github.com/php-http/adapter/releases)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Build Status](https://img.shields.io/travis/php-http/adapter.svg?style=flat-square)](https://travis-ci.org/php-http/adapter)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/adapter)
[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/adapter)
[![HHVM Status](https://img.shields.io/hhvm/php-http/adapter.svg?style=flat-square)](http://hhvm.h4cc.de/package/php-http/adapter)
[![Total Downloads](https://img.shields.io/packagist/dt/php-http/adapter.svg?style=flat-square)](https://packagist.org/packages/php-http/adapter)

**HTTP adapter contract.**
Expand All @@ -27,13 +23,6 @@ This is the contract package for HTTP Adapter. It should be used when implementi
There is also a virtual package which is versioned together with this contract package: [php-http/adapter-implementation](https://packagist.org/providers/php-http/adapter-implementation).


## Testing

``` bash
$ phpunit
```


## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
Expand Down
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"php": ">=5.4",
"psr/http-message": "^0.11"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"autoload": {
"psr-4": {
"Http\\Adapter\\": "src/"
Expand Down
13 changes: 0 additions & 13 deletions phpunit.xml.dist

This file was deleted.

20 changes: 20 additions & 0 deletions src/Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/*
* This file is part of the Http Adapter package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Http\Adapter;

/**
* @author Márk Sági-Kazár <[email protected]>
*/
interface Exception
{

}
64 changes: 64 additions & 0 deletions src/Exception/HttpAdapterException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/*
* This file is part of the Http Adapter package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Http\Adapter\Exception;

use Http\Adapter\Exception;
use Http\Adapter\Message\InternalRequest;
use Psr\Http\Message\ResponseInterface;

/**
* @author GeLo <[email protected]>
*/
interface HttpAdapterException extends Exception
{
/**
* Returns the request
*
* @return InternalRequest|null
*/
public function getRequest();

/**
* Checks if there is a request
*
* @return boolean
*/
public function hasRequest();

/**
* Sets the request
*
* @param InternalRequest|null $request
*/
public function setRequest(InternalRequest $request = null);

/**
* Returns the response
*
* @return ResponseInterface|null
*/
public function getResponse();

/**
* Checks if there is a response
*
* @return boolean
*/
public function hasResponse();

/**
* Sets the response
*
* @param ResponseInterface|null $response
*/
public function setResponse(ResponseInterface $response = null);
}
147 changes: 147 additions & 0 deletions src/Exception/MultiHttpAdapterException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?php

/*
* This file is part of the Http Adapter package.
*
* (c) Eric GELOEN <[email protected]>
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/

namespace Http\Adapter\Exception;

use Http\Adapter\Exception;
use Psr\Http\Message\ResponseInterface;

/**
* @author GeLo <[email protected]>
*/
interface MultiHttpAdapterException extends Exception
{
/**
* Returns all exceptions
*
* @return HttpAdapterException[]
*/
public function getExceptions();

/**
* Checks if a specific exception exists
*
* @param HttpAdapterException $exception
*
* @return boolean TRUE if there is the exception else FALSE.
*/
public function hasException(HttpAdapterException $exception);

/**
* Checks if any exception exists
*
* @return boolean
*/
public function hasExceptions();

/**
* Sets the exceptions
*
* @param HttpAdapterException[] $exceptions
*/
public function setExceptions(array $exceptions);

/**
* Adds an exception
*
* @param HttpAdapterException $exception
*/
public function addException(HttpAdapterException $exception);

/**
* Adds some exceptions
*
* @param HttpAdapterException[] $exceptions
*/
public function addExceptions(array $exceptions);

/**
* Removes an exception
*
* @param HttpAdapterException $exception
*/
public function removeException(HttpAdapterException $exception);

/**
* Removes some exceptions
*
* @param HttpAdapterException[] $exceptions
*/
public function removeExceptions(array $exceptions);

/**
* Clears all exceptions
*/
public function clearExceptions();

/**
* Returns all responses
*
* @return ResponseInterface[]
*/
public function getResponses();

/**
* Checks if a specific response exists
*
* @param ResponseInterface $response
*
* @return boolean
*/
public function hasResponse(ResponseInterface $response);

/**
* Checks if any response exists
*
* @return boolean
*/
public function hasResponses();

/**
* Sets the responses
*
* @param ResponseInterface[] $responses
*/
public function setResponses(array $responses);

/**
* Adds a response
*
* @param ResponseInterface $response
*/
public function addResponse(ResponseInterface $response);

/**
* Adds some responses
*
* @param ResponseInterface[] $responses
*/
public function addResponses(array $responses);

/**
* Removes a response
*
* @param ResponseInterface $response
*/
public function removeResponse(ResponseInterface $response);

/**
* Removes some responses
*
* @param ResponseInterface[] $responses
*/
public function removeResponses(array $responses);

/**
* Clears all responses
*/
public function clearResponses();
}
Loading