Skip to content

Commit 0d3bad2

Browse files
committed
Merge pull request #59 from php-http/utility_separation
Move Body, HttpError exceptions, BatchRequest, HttpMethods to utility
2 parents 81b532c + 644ebc5 commit 0d3bad2

39 files changed

+166
-1400
lines changed

CONDUCT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

CONTRIBUTING.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ please be as precise as possible. Here is a little list of required information:
1515

1616
## Security issues
1717

18-
If you discover any security related issues, please contact us at [[email protected]](mailto:[email protected]) instead of submitting an issue on Github. This allows us to fix the issue and release a security hotfix without publicly disclosing the vulnerability.
18+
If you discover any security related issues, please contact us at [[email protected]](mailto:[email protected])
19+
instead of submitting an issue on Github.
20+
This allows us to fix the issue and release a security hotfix without publicly disclosing the vulnerability.
1921

2022

2123
## Feature requests
@@ -28,7 +30,8 @@ easily understood/implement it.
2830

2931
## Sending a Pull Request
3032

31-
If you're here, you are going to fix a bug or implement a feature and you're the best! To do it, first fork the repository, clone it and create a new branch with the following commands:
33+
If you're here, you are going to fix a bug or implement a feature and you're the best!
34+
To do it, first fork the repository, clone it and create a new branch with the following commands:
3235

3336
``` bash
3437
$ git clone [email protected]:your-name/repo-name.git
@@ -41,7 +44,8 @@ Then install the dependencies through [Composer](https://getcomposer.org/):
4144
$ composer install
4245
```
4346

44-
Write code and tests. When you are ready, run the tests. (This is usually [PHPUnit](http://phpunit.de/) or [PHPSpec](http://phpspec.net/))
47+
Write code and tests. When you are ready, run the tests.
48+
(This is usually [PHPUnit](http://phpunit.de/) or [PHPSpec](http://phpspec.net/))
4549

4650
``` bash
4751
$ composer test
@@ -54,11 +58,15 @@ $ git commit -m "Feature or bug fix description"
5458
$ git push origin feature-or-bug-fix-description
5559
```
5660

57-
**Note:** Please write your commit messages in the imperative and follow the [guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.
61+
**Note:** Please write your commit messages in the imperative and follow the
62+
[guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.
5863

5964
Then [create a pull request](https://help.github.com/articles/creating-a-pull-request/) on GitHub.
6065

61-
Please make sure that each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting with the following commands (here, we assume you would like to squash 3 commits in a single one):
66+
Please make sure that each individual commit in your pull request is meaningful.
67+
If you had to make multiple intermediate commits while developing,
68+
please squash them before submitting with the following commands
69+
(here, we assume you would like to squash 3 commits in a single one):
6270

6371
``` bash
6472
$ git rebase -i HEAD~3
@@ -81,4 +89,12 @@ you must follow these rules.
8189

8290
## Semver
8391

84-
We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes, please let us know why you think it is important. In this case, your patch can only be included in the next major version.
92+
We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes,
93+
please let us know why you think it is important.
94+
In this case, your patch can only be included in the next major version.
95+
96+
97+
## Code of Conduct
98+
99+
This project is released with a [Contributor Code of Conduct](CONDUCT.md).
100+
By participating in this project you agree to abide by its terms.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ $ composer require php-http/httplug
2323

2424
## Intro
2525

26-
This is the contract package for HTTP Client. Use it to create HTTP Clients which are interoperable and compatible with [PSR-7](http://www.php-fig.org/psr/psr-7/).
26+
This is the contract package for HTTP Client.
27+
Use it to create HTTP Clients which are interoperable and compatible with [PSR-7](http://www.php-fig.org/psr/psr-7/).
2728

2829
This library is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter).
2930

@@ -41,7 +42,7 @@ $ composer test
4142

4243
## Contributing
4344

44-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
45+
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
4546

4647

4748
## Security

spec/BatchResultSpec.php

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

spec/Body/CombinedMultipartSpec.php

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

spec/Body/FilesSpec.php

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

spec/Body/MultipartDataSpec.php

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

spec/Body/UrlencodedDataSpec.php

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

spec/Exception/BatchExceptionSpec.php

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
class BatchExceptionSpec extends ObjectBehavior
1111
{
12+
function let(BatchResult $batchResult)
13+
{
14+
$this->beConstructedWith($batchResult);
15+
}
16+
1217
function it_is_initializable()
1318
{
1419
$this->shouldHaveType('Http\Client\Exception\BatchException');
@@ -24,46 +29,8 @@ function it_is_an_exception()
2429
$this->shouldImplement('Http\Client\Exception');
2530
}
2631

27-
function it_has_a_result()
28-
{
29-
$this->setResult($result = new BatchResult());
30-
$this->getResult()->shouldReturn($result);
31-
}
32-
33-
function it_throws_an_exception_if_the_result_is_already_set()
32+
function it_has_a_batch_result()
3433
{
3534
$this->getResult()->shouldHaveType('Http\Client\BatchResult');
36-
$this->shouldThrow('Http\Client\Exception\InvalidArgumentException')->duringSetResult(new BatchResult());
37-
}
38-
39-
function it_has_an_exception_for_a_request(RequestInterface $request, Exception $exception)
40-
{
41-
$this->shouldThrow('Http\Client\Exception\UnexpectedValueException')->duringGetExceptionFor($request);
42-
$this->hasExceptionFor($request)->shouldReturn(false);
43-
44-
$this->addException($request, $exception);
45-
46-
$this->getExceptionFor($request)->shouldReturn($exception);
47-
$this->hasExceptionFor($request)->shouldReturn(true);
48-
}
49-
50-
function it_has_exceptions(RequestInterface $request, Exception $exception)
51-
{
52-
$this->getExceptions()->shouldReturn([]);
53-
54-
$this->addException($request, $exception);
55-
56-
$this->getExceptions()->shouldReturn([$exception]);
57-
}
58-
59-
function it_checks_if_a_request_failed(RequestInterface $request, Exception $exception)
60-
{
61-
$this->isSuccessful($request)->shouldReturn(false);
62-
$this->isFailed($request)->shouldReturn(false);
63-
64-
$this->addException($request, $exception);
65-
66-
$this->isSuccessful($request)->shouldReturn(false);
67-
$this->isFailed($request)->shouldReturn(true);
6835
}
6936
}

0 commit comments

Comments
 (0)