Skip to content

Commit 4cd94b0

Browse files
authored
Version 1.0.0
2 parents 59624ed + 710c117 commit 4cd94b0

7 files changed

Lines changed: 18 additions & 19 deletions

File tree

.gitattributes

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
*.php diff=php
22

3-
/build export-ignore
4-
/Tests export-ignore
5-
/vendor export-ignore
3+
/build export-ignore
4+
/Tests export-ignore
5+
/vendor export-ignore
66
/.gitattributes export-ignore
7-
/.gitignore export-ignore
8-
/.travis.yml export-ignore
9-
/composer.lock export-ignore
10-
/phpunit.xml export-ignore
7+
/.gitignore export-ignore
8+
/.travis.yml export-ignore
9+
/composer.lock export-ignore
10+
/phpunit.xml export-ignore

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ addons:
1919
- memcached
2020

2121
php:
22+
- 7.1
2223
- 7.2
2324
- 7.3
24-
- nightly
2525

2626
matrix:
2727
fast_finish: true
28-
allow_failures:
29-
- php: nightly
3028

3129
before_install:
3230
- echo "extension=memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
@@ -42,4 +40,4 @@ script:
4240
- vendor/bin/phpunit --coverage-clover build/coverage/clover.xml
4341

4442
after_success:
45-
- travis_retry php vendor/bin/codacycoverage clover build/coverage/clover.xml
43+
- travis_retry vendor/bin/codacycoverage clover build/coverage/clover.xml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Koded Session
22
=============
33

4-
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1.4-8892BF.svg)](https://php.net/)
54
[![Latest Stable Version](https://img.shields.io/packagist/v/koded/session.svg)](https://packagist.org/packages/koded/session)
65
[![Build Status](https://travis-ci.org/kodedphp/session.svg?branch=master)](https://travis-ci.org/kodedphp/session)
76
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/358e1c798c0c4af8bec25a0adb2671e2)](https://www.codacy.com/app/kodeart/session)
87
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/358e1c798c0c4af8bec25a0adb2671e2)](https://www.codacy.com/app/kodeart/session)
8+
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1.4-8892BF.svg)](https://php.net/)
99
[![Software license](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE)
1010

1111

SessionAuthenticatedMiddleware.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Koded\Stdlib\Interfaces\ConfigurationFactory;
1717
use Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
1818
use Psr\Http\Server\{MiddlewareInterface, RequestHandlerInterface};
19+
use function Koded\Stdlib\json_serialize;
1920

2021

2122
class SessionAuthenticatedMiddleware implements MiddlewareInterface
@@ -38,7 +39,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
3839

3940
// Ajax requests should be handled in the browser
4041
if ('XMLHTTPREQUEST' === strtoupper($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '')) {
41-
return (new ServerResponse(json_encode([
42+
return (new ServerResponse(json_serialize([
4243
'location' => $this->redirectTo,
4344
'status' => StatusCode::UNAUTHORIZED
4445
]), StatusCode::UNAUTHORIZED));

Tests/SessionAuthenticatedMiddlewareTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ public function handle(ServerRequestInterface $request): ResponseInterface
5656

5757
$this->assertEquals('', $response->getHeaderLine('location'));
5858
$this->assertSame(StatusCode::UNAUTHORIZED, $response->getStatusCode());
59-
$this->assertSame('{"location":"\/signin","status":401}', (string)$response->getBody());
59+
$this->assertSame('{"location":"/signin","status":401}', (string)$response->getBody());
6060
}
6161

6262
public function test_process_when_authenticated()
6363
{
6464
$_SESSION[SessionAuthenticatedMiddleware::AUTHENTICATED] = true;
65-
$handler = new class implements RequestHandlerInterface
65+
66+
$handler = new class implements RequestHandlerInterface
6667
{
6768
public function handle(ServerRequestInterface $request): ResponseInterface
6869
{

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
1.0.0

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"require": {
1919
"php": "~7.3",
2020
"psr/http-server-middleware": "~1",
21-
"koded/cache-simple": "dev-2.0-dev",
22-
"koded/http": "dev-master",
21+
"koded/cache-simple": "~2",
22+
"koded/http": "~1",
2323
"ext-json": "*"
2424
},
2525
"autoload": {
@@ -46,7 +46,6 @@
4646
"phpunit/phpunit": "~7",
4747
"codacy/coverage": "dev-master"
4848
},
49-
"minimum-stability": "dev",
5049
"extra": {
5150
"branch-alias": {
5251
"dev-master": "1.0-dev"

0 commit comments

Comments
 (0)