Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit 0fb4377

Browse files
authored
Merge pull request #16 from sunrise-php/release/v1.1.0
v1.1.0
2 parents 5a05f4f + b40982d commit 0fb4377

File tree

83 files changed

+6975
-6920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+6975
-6920
lines changed

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@ insert_final_newline = true
1414
[*.md]
1515
trim_trailing_whitespace = false
1616

17-
[*.php]
18-
indent_style = tab
19-
2017
[*.yml]
2118
indent_size = 2

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.php_cs.cache
2+
.phpunit.result.cache
13
composer.lock
24
coverage.xml
5+
phpcs.xml
6+
phpunit.xml
37
vendor/

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ matrix:
55
- php: 7.1
66
- php: 7.2
77
- php: 7.3
8+
- php: 7.4
9+
- php: nightly
810
fast_finish: true
911

1012
before_install:
@@ -13,4 +15,4 @@ before_install:
1315
install:
1416
- travis_retry composer install --no-interaction --prefer-source --no-suggest
1517

16-
script: vendor/bin/phpunit --colors=always --coverage-text
18+
script: php vendor/bin/phpunit --colors=always --coverage-text

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Anatoly Fenric
3+
Copyright (c) 2018 Sunrise // PHP
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## HTTP Header Kit for PHP 7.1+ based on PSR-7
1+
## HTTP header kit for PHP 7.1+ (incl. PHP 8) based on PSR-7
22

33
[![Gitter](https://badges.gitter.im/sunrise-php/support.png)](https://gitter.im/sunrise-php/support)
4-
[![Build Status](https://api.travis-ci.com/sunrise-php/http-header-kit.svg?branch=master)](https://travis-ci.com/sunrise-php/http-header-kit)
4+
[![Build Status](https://scrutinizer-ci.com/g/sunrise-php/http-header-kit/badges/build.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/http-header-kit/build-status/master)
55
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sunrise-php/http-header-kit/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/http-header-kit/?branch=master)
66
[![Code Coverage](https://scrutinizer-ci.com/g/sunrise-php/http-header-kit/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/sunrise-php/http-header-kit/?branch=master)
77
[![Latest Stable Version](https://poser.pugx.org/sunrise/http-header-kit/v/stable)](https://packagist.org/packages/sunrise/http-header-kit)
@@ -10,7 +10,7 @@
1010

1111
## Installation
1212

13-
```
13+
```bash
1414
composer require sunrise/http-header-kit
1515
```
1616

@@ -662,10 +662,6 @@ $message = $header->setToMessage($message);
662662
php vendor/bin/phpunit
663663
```
664664

665-
## Api documentation
666-
667-
https://phpdoc.fenric.ru/
668-
669665
## Useful links
670666

671-
https://www.php-fig.org/psr/psr-7/
667+
* https://www.php-fig.org/psr/psr-7/

composer.json

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
{
22
"name": "sunrise/http-header-kit",
3-
"description": "Sunrise HTTP Header Kit for PHP 7.1+ based on PSR-7",
4-
"keywords": ["fenric", "sunrise", "http-header-kit", "http", "header", "kit", "psr-7"],
53
"homepage": "https://github.com/sunrise-php/http-header-kit",
4+
"description": "Sunrise HTTP header kit for PHP 7.1+ based on PSR-7",
65
"license": "MIT",
6+
"keywords": [
7+
"fenric",
8+
"sunrise",
9+
"http",
10+
"header",
11+
"kit",
12+
"http-header-kit",
13+
"psr-7",
14+
"php7",
15+
"php8"
16+
],
717
"authors": [
818
{
919
"name": "Anatoly Fenric",
@@ -12,15 +22,15 @@
1222
}
1323
],
1424
"require": {
15-
"php": "^7.1",
25+
"php": "^7.1|^8.0",
1626
"psr/http-message": "^1.0",
17-
"sunrise/http-header": "^1.0",
18-
"sunrise/http-header-collection": "^1.0"
27+
"sunrise/http-header": "^1.1",
28+
"sunrise/http-header-collection": "^1.1"
1929
},
2030
"require-dev": {
21-
"phpunit/phpunit": "7.5.6",
22-
"sunrise/http-message": "1.0.15",
23-
"sunrise/uri": "1.0.25"
31+
"phpunit/phpunit": "7.5.20|9.5.0",
32+
"sunrise/coding-standard": "1.0.0",
33+
"sunrise/http-factory": "1.1.0"
2434
},
2535
"autoload": {
2636
"psr-4": {
@@ -29,7 +39,8 @@
2939
},
3040
"scripts": {
3141
"test": [
32-
"phpunit --colors=always --coverage-text"
42+
"phpunit --colors=always --coverage-text",
43+
"phpcs"
3344
]
3445
}
3546
}

phpcs.xml.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Sunrise Coding Standard">
3+
<rule ref="./vendor/sunrise/coding-standard/ruleset.xml"/>
4+
5+
<file>src</file>
6+
<file>tests</file>
7+
</ruleset>

src/AbstractHeader.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,36 @@
2222
abstract class AbstractHeader implements HeaderInterface
2323
{
2424

25-
/**
26-
* {@inheritDoc}
27-
*/
28-
public function setToMessage(MessageInterface $message) : MessageInterface
29-
{
30-
return $message->withHeader(
31-
$this->getFieldName(),
32-
$this->getFieldValue()
33-
);
34-
}
25+
/**
26+
* {@inheritDoc}
27+
*/
28+
public function setToMessage(MessageInterface $message) : MessageInterface
29+
{
30+
return $message->withHeader(
31+
$this->getFieldName(),
32+
$this->getFieldValue()
33+
);
34+
}
3535

36-
/**
37-
* {@inheritDoc}
38-
*/
39-
public function addToMessage(MessageInterface $message) : MessageInterface
40-
{
41-
return $message->withAddedHeader(
42-
$this->getFieldName(),
43-
$this->getFieldValue()
44-
);
45-
}
36+
/**
37+
* {@inheritDoc}
38+
*/
39+
public function addToMessage(MessageInterface $message) : MessageInterface
40+
{
41+
return $message->withAddedHeader(
42+
$this->getFieldName(),
43+
$this->getFieldValue()
44+
);
45+
}
4646

47-
/**
48-
* {@inheritDoc}
49-
*/
50-
public function __toString()
51-
{
52-
return \sprintf('%s: %s',
53-
$this->getFieldName(),
54-
$this->getFieldValue()
55-
);
56-
}
47+
/**
48+
* {@inheritDoc}
49+
*/
50+
public function __toString()
51+
{
52+
return \sprintf('%s: %s',
53+
$this->getFieldName(),
54+
$this->getFieldValue()
55+
);
56+
}
5757
}

src/HeaderAccessControlAllowCredentials.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
class HeaderAccessControlAllowCredentials extends AbstractHeader implements HeaderInterface
2020
{
2121

22-
/**
23-
* {@inheritDoc}
24-
*/
25-
public function getFieldName() : string
26-
{
27-
return 'Access-Control-Allow-Credentials';
28-
}
22+
/**
23+
* {@inheritDoc}
24+
*/
25+
public function getFieldName() : string
26+
{
27+
return 'Access-Control-Allow-Credentials';
28+
}
2929

30-
/**
31-
* {@inheritDoc}
32-
*/
33-
public function getFieldValue() : string
34-
{
35-
return 'true';
36-
}
30+
/**
31+
* {@inheritDoc}
32+
*/
33+
public function getFieldValue() : string
34+
{
35+
return 'true';
36+
}
3737
}

src/HeaderAccessControlAllowHeaders.php

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,82 +19,82 @@
1919
class HeaderAccessControlAllowHeaders extends AbstractHeader implements HeaderInterface
2020
{
2121

22-
/**
23-
* The header value
24-
*
25-
* @var array
26-
*/
27-
protected $value = [];
22+
/**
23+
* The header value
24+
*
25+
* @var array
26+
*/
27+
protected $value = [];
2828

29-
/**
30-
* Constructor of the class
31-
*
32-
* @param string ...$value
33-
*/
34-
public function __construct(string ...$value)
35-
{
36-
$this->setValue(...$value);
37-
}
29+
/**
30+
* Constructor of the class
31+
*
32+
* @param string ...$value
33+
*/
34+
public function __construct(string ...$value)
35+
{
36+
$this->setValue(...$value);
37+
}
3838

39-
/**
40-
* Sets the header value
41-
*
42-
* @param string ...$value
43-
*
44-
* @return self
45-
*
46-
* @throws \InvalidArgumentException
47-
*/
48-
public function setValue(string ...$value) : self
49-
{
50-
foreach ($value as $oneOf)
51-
{
52-
if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $oneOf))
53-
{
54-
throw new \InvalidArgumentException(\sprintf('The value "%s" for the header "%s" is not valid', $oneOf, $this->getFieldName()));
55-
}
39+
/**
40+
* Sets the header value
41+
*
42+
* @param string ...$value
43+
*
44+
* @return self
45+
*
46+
* @throws \InvalidArgumentException
47+
*/
48+
public function setValue(string ...$value) : self
49+
{
50+
foreach ($value as $oneOf) {
51+
if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $oneOf)) {
52+
throw new \InvalidArgumentException(
53+
\sprintf('The value "%s" for the header "%s" is not valid', $oneOf, $this->getFieldName())
54+
);
55+
}
5656

57-
$this->value[$oneOf] = true;
58-
}
57+
$this->value[$oneOf] = true;
58+
}
5959

60-
return $this;
61-
}
60+
return $this;
61+
}
6262

63-
/**
64-
* Gets the header value
65-
*
66-
* @return array
67-
*/
68-
public function getValue() : array
69-
{
70-
return \array_keys($this->value);
71-
}
63+
/**
64+
* Gets the header value
65+
*
66+
* @return array
67+
*/
68+
public function getValue() : array
69+
{
70+
return \array_keys($this->value);
71+
}
7272

73-
/**
74-
* Resets the header value
75-
*
76-
* @return self
77-
*/
78-
public function resetValue() : self
79-
{
80-
$this->value = [];
73+
/**
74+
* Resets the header value
75+
*
76+
* @return self
77+
*/
78+
public function resetValue() : self
79+
{
80+
$this->value = [];
8181

82-
return $this;
83-
}
82+
return $this;
83+
}
8484

85-
/**
86-
* {@inheritDoc}
87-
*/
88-
public function getFieldName() : string
89-
{
90-
return 'Access-Control-Allow-Headers';
91-
}
85+
/**
86+
* {@inheritDoc}
87+
*/
88+
public function getFieldName() : string
89+
{
90+
return 'Access-Control-Allow-Headers';
91+
}
9292

93-
/**
94-
* {@inheritDoc}
95-
*/
96-
public function getFieldValue() : string
97-
{
98-
return \implode(', ', $this->getValue());
99-
}
93+
/**
94+
* {@inheritDoc}
95+
*/
96+
public function getFieldValue() : string
97+
{
98+
return \implode(', ', $this->getValue());
99+
}
100100
}

0 commit comments

Comments
 (0)