Skip to content

Commit 0df69c4

Browse files
author
Aurimas Niekis
committed
Initial commit
0 parents  commit 0df69c4

31 files changed

+1342
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
; top-most EditorConfig file
2+
root = true
3+
4+
; Unix-style newlines
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
src/Tests export-ignore
2+
.editorconfig export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
.scrutinizer.yml export-ignore
6+
.travis.yml export-ignore
7+
CONTRIBUTING.md export-ignore
8+
CONDUCT.md export-ignore
9+
phpunit.xml.ci export-ignore
10+
phpunit.xml.dist export-ignore

.gitignore

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

.scrutinizer.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
filter:
2+
paths: [src/*]
3+
excluded_paths: [src/Tests/*]
4+
5+
checks:
6+
php:
7+
code_rating: true
8+
duplication: true
9+
10+
tools:
11+
external_code_coverage:
12+
timeout: 600
13+
php_code_sniffer:
14+
config:
15+
standard: "PSR2"

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: php
2+
3+
cache:
4+
directories:
5+
- $HOME/.composer/cache
6+
7+
php:
8+
- 7.0
9+
10+
before_install:
11+
- travis_retry composer self-update
12+
13+
install:
14+
- travis_retry composer update --no-interaction
15+
16+
script:
17+
- composer test-ci
18+
19+
after_success:
20+
- wget https://scrutinizer-ci.com/ocular.phar
21+
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

CONDUCT.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of
4+
fostering an open and welcoming community, we pledge to respect all people who
5+
contribute through reporting issues, posting feature requests, updating
6+
documentation, submitting pull requests or patches, and other activities.
7+
8+
We are committed to making participation in this project a harassment-free
9+
experience for everyone, regardless of level of experience, gender, gender
10+
identity and expression, sexual orientation, disability, personal appearance,
11+
body size, race, ethnicity, age, religion, or nationality.
12+
13+
Examples of unacceptable behavior by participants include:
14+
15+
* The use of sexualized language or imagery
16+
* Personal attacks
17+
* Trolling or insulting/derogatory comments
18+
* Public or private harassment
19+
* Publishing other's private information, such as physical or electronic
20+
addresses, without explicit permission
21+
* Other unethical or unprofessional conduct
22+
23+
Project maintainers have the right and responsibility to remove, edit, or
24+
reject comments, commits, code, wiki edits, issues, and other contributions
25+
that are not aligned to this Code of Conduct, or to ban temporarily or
26+
permanently any contributor for other behaviors that they deem inappropriate,
27+
threatening, offensive, or harmful.
28+
29+
By adopting this Code of Conduct, project maintainers commit themselves to
30+
fairly and consistently applying these principles to every aspect of managing
31+
this project. Project maintainers who do not follow or enforce the Code of
32+
Conduct may be permanently removed from the project team.
33+
34+
This code of conduct applies both within project spaces and in public spaces
35+
when an individual is representing the project or its community.
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
38+
reported by contacting a project maintainer at [Aurimas Niekis][email]. All
39+
complaints will be reviewed and investigated and will result in a response that
40+
is deemed necessary and appropriate to the circumstances. Maintainers are
41+
obligated to maintain confidentiality with regard to the reporter of an
42+
incident.
43+
44+
45+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
46+
version 1.3.0, available at
47+
[http://contributor-covenant.org/version/1/3/0/][version]
48+
49+
[homepage]: http://contributor-covenant.org
50+
[version]: http://contributor-covenant.org/version/1/3/0/
51+
[email]: mailto:aurimas@niekis.lt

CONTRIBUTING.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Contributing
2+
3+
If you're here, you would like to contribute to this repository and you're really welcome!
4+
5+
6+
## Bug reports
7+
8+
If you find a bug or a documentation issue, please report it or even better: fix it :). If you report it,
9+
please be as precise as possible. Here is a little list of required information:
10+
11+
- Precise description of the bug
12+
- Details of your environment (for example: OS, PHP version, installed extensions)
13+
- Backtrace which might help identifing the bug
14+
15+
16+
## Feature requests
17+
18+
If you think a feature is missing, please report it or even better: implement it :). If you report it, describe the more
19+
precisely what you would like to see implemented and we will discuss what is the best approach for it. If you can do
20+
some research before submitting it and link the resources to your description, you're awesome! It will allow us to more
21+
easily understood/implement it.
22+
23+
24+
## Sending a Pull Request
25+
26+
If you're here, you are going to fix a bug or implement a feature and you're the best!
27+
To do it, first fork the repository, clone it and create a new branch with the following commands:
28+
29+
``` bash
30+
$ git clone git@github.com:your-name/repo-name.git
31+
$ git checkout -b feature-or-bug-fix-description
32+
```
33+
34+
Then install the dependencies through [Composer](https://getcomposer.org/):
35+
36+
``` bash
37+
$ composer install
38+
```
39+
40+
Write code and tests. When you are ready, run the tests.
41+
(This is usually [PHPUnit](http://phpunit.de/))
42+
43+
``` bash
44+
$ composer test
45+
```
46+
47+
When you are ready with the code, tested it and documented it, you can commit and push it with the following commands:
48+
49+
``` bash
50+
$ git commit -m "Feature or bug fix description"
51+
$ git push origin feature-or-bug-fix-description
52+
```
53+
54+
**Note:** Please write your commit messages in the imperative and follow the
55+
[guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.
56+
57+
Then [create a pull request](https://help.github.com/articles/creating-a-pull-request/) on GitHub.
58+
59+
Please make sure that each individual commit in your pull request is meaningful.
60+
If you had to make multiple intermediate commits while developing,
61+
please squash them before submitting with the following commands
62+
(here, we assume you would like to squash 3 commits in a single one):
63+
64+
``` bash
65+
$ git rebase -i HEAD~3
66+
```
67+
68+
If your branch conflicts with the master branch, you will need to rebase and repush it with the following commands:
69+
70+
``` bash
71+
$ git remote add upstream git@github.com:php-http/repo-name.git
72+
$ git pull --rebase upstream master
73+
$ git push -f origin feature-or-bug-fix-description
74+
```
75+
76+
77+
## Coding standard
78+
79+
This repository follows the [PSR-2 standard](http://www.php-fig.org/psr/psr-2/) and so, if you want to contribute,
80+
you must follow these rules.
81+
82+
83+
## Semver
84+
85+
We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes,
86+
please let us know why you think it is important.
87+
In this case, your patch can only be included in the next major version.
88+
89+
90+
## Code of Conduct
91+
92+
This project is released with a [Contributor Code of Conduct](CONDUCT.md).
93+
By participating in this project you agree to abide by its terms.

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Aurimas Niekis
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Http Component
2+
3+
[![Latest Version](https://img.shields.io/github/release/ThrusterIO/http.svg?style=flat-square)]
4+
(https://github.com/ThrusterIO/http/releases)
5+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)]
6+
(LICENSE)
7+
[![Build Status](https://img.shields.io/travis/ThrusterIO/http.svg?style=flat-square)]
8+
(https://travis-ci.org/ThrusterIO/http)
9+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/ThrusterIO/http.svg?style=flat-square)]
10+
(https://scrutinizer-ci.com/g/ThrusterIO/http)
11+
[![Quality Score](https://img.shields.io/scrutinizer/g/ThrusterIO/http.svg?style=flat-square)]
12+
(https://scrutinizer-ci.com/g/ThrusterIO/http)
13+
[![Total Downloads](https://img.shields.io/packagist/dt/thruster/http.svg?style=flat-square)]
14+
(https://packagist.org/packages/thruster/http)
15+
16+
[![Email](https://img.shields.io/badge/email-team@thruster.io-blue.svg?style=flat-square)]
17+
(mailto:team@thruster.io)
18+
19+
The Thruster Http Component.
20+
21+
22+
## Install
23+
24+
Via Composer
25+
26+
``` bash
27+
$ composer require thruster/http
28+
```
29+
30+
31+
## Testing
32+
33+
``` bash
34+
$ composer test
35+
```
36+
37+
38+
## Contributing
39+
40+
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
41+
42+
43+
## License
44+
45+
Please see [License File](LICENSE) for more information.

composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "thruster/http",
3+
"type": "library",
4+
"description": "Thruster Http Component",
5+
"keywords": ["http", "thruster"],
6+
"homepage": "https://thruster.io",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "Aurimas Niekis",
11+
"email": "aurimas@niekis.lt"
12+
}
13+
],
14+
"require": {
15+
"php": ">=7.0",
16+
"psr/http-message": "~1.0",
17+
"guzzlehttp/psr7": "~1.2",
18+
"thruster/event-emitter": "~1.0"
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "~5.0"
22+
},
23+
"autoload": {
24+
"psr-4": { "Thruster\\Component\\Http\\": "src" }
25+
},
26+
"scripts": {
27+
"test": "vendor/bin/phpunit",
28+
"test-ci": "vendor/bin/phpunit -c phpunit.xml.ci"
29+
},
30+
"extra": {
31+
"branch-alias": {
32+
"dev-master": "1.0-dev"
33+
}
34+
}
35+
}

phpunit.xml.ci

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.0/phpunit.xsd"
5+
backupGlobals="false"
6+
colors="true"
7+
bootstrap="vendor/autoload.php"
8+
>
9+
<php>
10+
<ini name="error_reporting" value="-1" />
11+
</php>
12+
13+
<testsuites>
14+
<testsuite name="Thruster Http Component Test Suite">
15+
<directory>./src/Tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<filter>
20+
<whitelist>
21+
<directory>./src</directory>
22+
<exclude>
23+
<directory>./src/Tests</directory>
24+
</exclude>
25+
</whitelist>
26+
</filter>
27+
28+
<logging>
29+
<log type="coverage-clover" target="build/logs/clover.xml"/>
30+
<log type="coverage-html" target="build/logs/html"/>
31+
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
32+
</logging>
33+
34+
</phpunit>

phpunit.xml.dist

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.0/phpunit.xsd"
5+
backupGlobals="false"
6+
colors="true"
7+
bootstrap="vendor/autoload.php"
8+
>
9+
<php>
10+
<ini name="error_reporting" value="-1" />
11+
</php>
12+
13+
<testsuites>
14+
<testsuite name="Thruster Http Component Test Suite">
15+
<directory>./src/Tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<filter>
20+
<whitelist>
21+
<directory>./src</directory>
22+
<exclude>
23+
<directory>./src/Tests</directory>
24+
</exclude>
25+
</whitelist>
26+
</filter>
27+
</phpunit>

src/Exception/BadRequestException.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Thruster\Component\Http\Exception;
4+
5+
/**
6+
* Class BadRequestException
7+
*
8+
* @package Thruster\Component\Http\Exception
9+
* @author Aurimas Niekis <aurimas@niekis.lt>
10+
*/
11+
class BadRequestException extends RequestException
12+
{
13+
public function __construct()
14+
{
15+
$message = 'Bad Request';
16+
17+
parent::__construct(400, $message);
18+
}
19+
}

0 commit comments

Comments
 (0)