Skip to content

Commit 5521fa8

Browse files
committed
Removes concrete implementations and testing
1 parent ee6c675 commit 5521fa8

15 files changed

+186
-718
lines changed

.gitattributes

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
tests/ export-ignore
21
.editorconfig export-ignore
32
.gitattributes export-ignore
43
.gitignore export-ignore
5-
.scrutinizer.yml export-ignore
6-
.travis.yml export-ignore
74
CONTRIBUTING.md export-ignore
8-
phpunit.xml.dist export-ignore

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
build/
22
vendor/
33
composer.lock
4-
phpunit.xml

.scrutinizer.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ This is the contract package for HTTP Adapter. It should be used when implementi
2727
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).
2828

2929

30-
## Testing
31-
32-
``` bash
33-
$ phpunit
34-
```
35-
36-
3730
## Contributing
3831

3932
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
"php": ">=5.4",
1515
"psr/http-message": "~1.0"
1616
},
17-
"require-dev": {
18-
"phpunit/phpunit": "~4.4"
19-
},
2017
"autoload": {
2118
"psr-4": {
2219
"Http\\Adapter\\": "src/"

phpunit.xml.dist

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Exception.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Adapter package.
5+
*
6+
* (c) Eric GELOEN <[email protected]>
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Adapter;
13+
14+
/**
15+
* @author Márk Sági-Kazár <[email protected]>
16+
*/
17+
interface Exception
18+
{
19+
20+
}

src/HttpAdapterException.php renamed to src/Exception/HttpAdapterException.php

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,83 +9,56 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Http\Adapter;
12+
namespace Http\Adapter\Exception;
1313

14+
use Http\Adapter\Exception;
1415
use Http\Adapter\Message\InternalRequest;
1516
use Psr\Http\Message\ResponseInterface;
1617

1718
/**
1819
* @author GeLo <[email protected]>
1920
*/
20-
class HttpAdapterException extends \Exception
21+
interface HttpAdapterException extends Exception
2122
{
22-
/**
23-
* @var InternalRequest|null
24-
*/
25-
private $request;
26-
27-
/**
28-
* @var ResponseInterface|null
29-
*/
30-
private $response;
31-
3223
/**
3324
* Returns the request
3425
*
3526
* @return InternalRequest|null
3627
*/
37-
public function getRequest()
38-
{
39-
return $this->request;
40-
}
28+
public function getRequest();
4129

4230
/**
4331
* Checks if there is a request
4432
*
4533
* @return boolean
4634
*/
47-
public function hasRequest()
48-
{
49-
return isset($this->request);
50-
}
35+
public function hasRequest();
5136

5237
/**
5338
* Sets the request
5439
*
5540
* @param InternalRequest|null $request
5641
*/
57-
public function setRequest(InternalRequest $request = null)
58-
{
59-
$this->request = $request;
60-
}
42+
public function setRequest(InternalRequest $request = null);
6143

6244
/**
6345
* Returns the response
6446
*
6547
* @return ResponseInterface|null
6648
*/
67-
public function getResponse()
68-
{
69-
return $this->response;
70-
}
49+
public function getResponse();
7150

7251
/**
7352
* Checks if there is a response
7453
*
7554
* @return boolean
7655
*/
77-
public function hasResponse()
78-
{
79-
return isset($this->response);
80-
}
56+
public function hasResponse();
8157

8258
/**
8359
* Sets the response
8460
*
8561
* @param ResponseInterface|null $response
8662
*/
87-
public function setResponse(ResponseInterface $response = null)
88-
{
89-
$this->response = $response;
90-
}
63+
public function setResponse(ResponseInterface $response = null);
9164
}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Adapter package.
5+
*
6+
* (c) Eric GELOEN <[email protected]>
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Adapter\Exception;
13+
14+
use Psr\Http\Message\ResponseInterface;
15+
16+
/**
17+
* @author GeLo <[email protected]>
18+
*/
19+
interface MultiHttpAdapterException extends Exception
20+
{
21+
/**
22+
* Returns all exceptions
23+
*
24+
* @return HttpAdapterException[]
25+
*/
26+
public function getExceptions();
27+
28+
/**
29+
* Checks if a specific exception exists
30+
*
31+
* @param HttpAdapterException $exception
32+
*
33+
* @return boolean TRUE if there is the exception else FALSE.
34+
*/
35+
public function hasException(HttpAdapterException $exception);
36+
37+
/**
38+
* Checks if any exception exists
39+
*
40+
* @return boolean
41+
*/
42+
public function hasExceptions();
43+
44+
/**
45+
* Sets the exceptions
46+
*
47+
* @param HttpAdapterException[] $exceptions
48+
*/
49+
public function setExceptions(array $exceptions);
50+
51+
/**
52+
* Adds an exception
53+
*
54+
* @param HttpAdapterException $exception
55+
*/
56+
public function addException(HttpAdapterException $exception);
57+
58+
/**
59+
* Adds some exceptions
60+
*
61+
* @param HttpAdapterException[] $exceptions
62+
*/
63+
public function addExceptions(array $exceptions);
64+
65+
/**
66+
* Removes an exception
67+
*
68+
* @param HttpAdapterException $exception
69+
*/
70+
public function removeException(HttpAdapterException $exception);
71+
72+
/**
73+
* Removes some exceptions
74+
*
75+
* @param HttpAdapterException[] $exceptions
76+
*/
77+
public function removeExceptions(array $exceptions);
78+
79+
/**
80+
* Clears all exceptions
81+
*/
82+
public function clearExceptions();
83+
84+
/**
85+
* Returns all responses
86+
*
87+
* @return ResponseInterface[]
88+
*/
89+
public function getResponses();
90+
91+
/**
92+
* Checks if a specific response exists
93+
*
94+
* @param ResponseInterface $response
95+
*
96+
* @return boolean
97+
*/
98+
public function hasResponse(ResponseInterface $response);
99+
100+
/**
101+
* Checks if any response exists
102+
*
103+
* @return boolean
104+
*/
105+
public function hasResponses();
106+
107+
/**
108+
* Sets the responses
109+
*
110+
* @param ResponseInterface[] $responses
111+
*/
112+
public function setResponses(array $responses);
113+
114+
/**
115+
* Adds a response
116+
*
117+
* @param ResponseInterface $response
118+
*/
119+
public function addResponse(ResponseInterface $response);
120+
121+
/**
122+
* Adds some responses
123+
*
124+
* @param ResponseInterface[] $responses
125+
*/
126+
public function addResponses(array $responses);
127+
128+
/**
129+
* Removes a response
130+
*
131+
* @param ResponseInterface $response
132+
*/
133+
public function removeResponse(ResponseInterface $response);
134+
135+
/**
136+
* Removes some responses
137+
*
138+
* @param ResponseInterface[] $responses
139+
*/
140+
public function removeResponses(array $responses);
141+
142+
/**
143+
* Clears all responses
144+
*/
145+
public function clearResponses();
146+
}

0 commit comments

Comments
 (0)