Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  update doc
  replace travis by github ci
  add exception message wherever possible
  CS
  methods with side effects must return void
  CS
  specify const visibility
  add psalm
  rename fromString to of
  rename __toString to toString
  update deps
  require php 7.4
  update to phpunit 8
  • Loading branch information
Baptouuuu committed Mar 23, 2020
2 parents 439ae68 + bb15ff7 commit 1c88383
Show file tree
Hide file tree
Showing 110 changed files with 1,997 additions and 2,078 deletions.
2 changes: 0 additions & 2 deletions .gitattributes
@@ -1,7 +1,5 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/fixtures export-ignore
/tests export-ignore
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,65 @@
name: CI

on: [push]

jobs:
phpunit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['7.4']
name: 'PHPUnit - PHP/${{ matrix.php-version }} - OS/${{ matrix.os }}'
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug
ini-values: xdebug.max_nesting_level=2048
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: composer install --no-progress
- name: PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage.clover
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
psalm:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.4']
name: 'Psalm - PHP/${{ matrix.php-version }}'
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: composer install --no-progress
- name: Psalm
run: vendor/bin/psalm --shepherd
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
composer.lock
vendor
.phpunit.result.cache
7 changes: 0 additions & 7 deletions .scrutinizer.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

18 changes: 10 additions & 8 deletions README.md
@@ -1,10 +1,8 @@
# RestClient

| `master` | `develop` |
|----------|-----------|
| [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Innmind/rest-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Innmind/rest-client/?branch=master) | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Innmind/rest-client/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/Innmind/rest-client/?branch=develop) |
| [![Code Coverage](https://scrutinizer-ci.com/g/Innmind/rest-client/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Innmind/rest-client/?branch=master) | [![Code Coverage](https://scrutinizer-ci.com/g/Innmind/rest-client/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/Innmind/rest-client/?branch=develop) |
| [![Build Status](https://scrutinizer-ci.com/g/Innmind/rest-client/badges/build.png?b=master)](https://scrutinizer-ci.com/g/Innmind/rest-client/build-status/master) | [![Build Status](https://scrutinizer-ci.com/g/Innmind/rest-client/badges/build.png?b=develop)](https://scrutinizer-ci.com/g/Innmind/rest-client/build-status/develop) |
[![Build Status](https://github.com/Innmind/rest-client/workflows/CI/badge.svg)](https://github.com/Innmind/rest-client/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/Innmind/rest-client/branch/develop/graph/badge.svg)](https://codecov.io/gh/Innmind/rest-client)
[![Type Coverage](https://shepherd.dev/github/Innmind/rest-client/coverage.svg)](https://shepherd.dev/github/Innmind/rest-client)


This library is intended to consume APIs built with the [`RestServer`](https://github.com/Innmind/rest-server).
Expand All @@ -18,12 +16,16 @@ composer require innmind/rest-client
## Usage

```php
use Innmind\OperatingSystem\Factory;
use Innmind\Url\Path;
use Innmind\UrlResolver\UrlResolver;
use function Innmind\Rest\Client\bootstrap;

$os = Factory::build();
$client = bootstrap(
/* instance of Innmind\HttpTransport\Transport */,
/* instance of Innmind\UrlResolver\ResolverInterface */,
/* instance of Innmind\Filesystem\Adapter */
$os->remote()->http(),
new UrlResolver,
$os->filesystem()->mount(Path::of('/somewhere/to/cache/data')),
);

$client
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
@@ -0,0 +1,2 @@
ignore:
- graph.php
20 changes: 9 additions & 11 deletions composer.json
Expand Up @@ -15,13 +15,12 @@
"issues": "http://github.com/Innmind/rest-client/issues"
},
"require": {
"php": "~7.2",
"innmind/immutable": "~2.12",
"php": "~7.4",
"innmind/immutable": "~3.5",
"innmind/specification": "~2.0",
"innmind/http": "~3.8",
"innmind/filesystem": "~3.0",
"innmind/url-resolver": "~3.0",
"innmind/http-transport": "~4.0",
"innmind/http": "~4.2",
"innmind/operating-system": "~2.0",
"innmind/url-resolver": "~4.0",
"willdurand/negotiation": "^2.2",
"innmind/json": "^1.1"
},
Expand All @@ -40,10 +39,9 @@
"test": "vendor/bin/phpunit --colors=always"
},
"require-dev": {
"phpunit/phpunit": "~7.0",
"innmind/cli": "^1.5",
"innmind/server-control": "^2.7",
"innmind/server-status": "^1.3",
"innmind/object-graph": "^1.2"
"phpunit/phpunit": "~8.0",
"innmind/cli": "~2.0",
"innmind/object-graph": "~2.0",
"vimeo/psalm": "^3.10"
}
}
11 changes: 5 additions & 6 deletions graph.php
Expand Up @@ -19,8 +19,7 @@
Visitor\RemoveDependenciesSubGraph,
};
use Innmind\Url\{
UrlInterface,
PathInterface,
Url,
Path,
};

Expand All @@ -39,15 +38,15 @@ protected function main(Environment $env, OperatingSystem $os): void
$visualize = new Visualize(new class($env->workingDirectory()) implements LocationRewriter {
private $workingDirectory;

public function __construct(PathInterface $workingDirectory)
public function __construct(Path $workingDirectory)
{
$this->workingDirectory = $workingDirectory;
}

public function __invoke(UrlInterface $location): UrlInterface
public function __invoke(Url $location): Url
{
return $location->withPath(new Path(
\str_replace((string) $this->workingDirectory, '', (string) $location->path())
return $location->withPath(Path::of(
\str_replace($this->workingDirectory->toString(), '', $location->path()->toString())
));
}
});
Expand Down

0 comments on commit 1c88383

Please sign in to comment.