Skip to content

Commit

Permalink
Add codecov and Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Jan 13, 2017
1 parent eb8094c commit d7ad5b3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,17 @@
inherit: true

filter:
paths: [src/*, tests/*]

checks:
php:
code_rating: true
duplication: true

build:
dependencies:
override:
- true
tests:
override:
- phpcs-run
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -16,7 +16,7 @@ before_script:
- cd ~/builds/ss

script:
- vendor/bin/phpunit psr7-adapters/tests
- vendor/bin/phpunit psr7-adapters/tests --coverage-clover=coverage.xml

after_success:
- bash <(curl -s https://codecov.io/bash)
10 changes: 8 additions & 2 deletions README.md
@@ -1,6 +1,7 @@
# robbie/psr7-adapters

[![Build Status](https://travis-ci.org/robbieaverill/psr7-adapters.svg?branch=master)](https://travis-ci.org/robbieaverill/psr7-adapters)
[![Build Status](https://travis-ci.org/robbieaverill/psr7-adapters.svg?branch=master)](https://travis-ci.org/robbieaverill/psr7-adapters) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/robbieaverill/psr7-adapters/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/robbieaverill/psr7-adapters/?branch=master) [![codecov](https://codecov.io/gh/robbieaverill/psr7-adapters/branch/master/graph/badge.svg)](https://codecov.io/gh/robbieaverill/psr7-adapters)


PSR-7 compliant, immutable adapter interfaces for SilverStripe HTTP classes.

Expand Down Expand Up @@ -46,15 +47,19 @@ $response = $myResponse->toPsr7();
From here you can use any of the PSR-7 interface methods, and the results will always be immutable:

```php
<?php

$newResponse = $response->withHeader('Content-Type', 'application/json');
$newResponse = $newResponse->withHeader('X-Custom-Header', 'my-value-here');

// $response !== $newResponse
// $response !== $newResponse -> #psr7-ftw
```

The same concept applies to the `HttpRequestAdapter`, for example:

```php
<?php

# Context: PageController
use Robbie\Psr7\HttpRequestAdapter;

Expand All @@ -64,5 +69,6 @@ $request = $this->getRequest();
$adapter = new HttpRequestAdapter($request);
$psrInterface = $adapter->toPsr7();

// Outputs all your initial request headers:
print_r($psrInterface->getHeaders());
```
6 changes: 6 additions & 0 deletions phpcs.xml
@@ -0,0 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<file>./src</file>
<file>./tests</file>
<rule ref="PSR2" />
</ruleset>

0 comments on commit d7ad5b3

Please sign in to comment.