-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
903 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.gitignore export-ignore | ||
.gitattributes export-ignore | ||
.php-cs-fixer.php export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: [ master, 'up' ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: nanasess/setup-php@v3.3.2 | ||
with: | ||
php-version: '8.1' | ||
|
||
- name: Validate composer.json | ||
run: composer validate | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}-2 | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --no-progress --no-suggest | ||
|
||
- name: Lint | ||
run: composer lint | ||
|
||
- name: Stat Analyse | ||
run: composer stat-analyse | ||
|
||
- name: Test | ||
run: composer test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/composer.lock | ||
/vendor/ | ||
/.phpunit.result.cache | ||
/.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create()->in(['src', 'tests']); | ||
|
||
return (new \PhpCsFixer\Config()) | ||
->registerCustomFixers([ | ||
new \ArtARTs36\PhpCsFixerGoodFixers\Fixer\InterfaceMethodPhpDocSummaryFixer(), | ||
new \ArtARTs36\PhpCsFixerGoodFixers\Fixer\DisableFunctionFixer(), | ||
new \ArtARTs36\PhpCsFixerGoodFixers\Fixer\LaravelCommandNoEmptyDescriptionFixer(), | ||
]) | ||
->setRules([ | ||
'full_opening_tag' => true, | ||
'not_operator_with_successor_space' => true, | ||
'trailing_comma_in_multiline' => true, | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'array_indentation' => true, | ||
'binary_operator_spaces' => [ | ||
'operators' => [ | ||
'=' => 'single_space', | ||
'=>' => null, | ||
'|' => null, | ||
], | ||
], | ||
'@PSR12' => true, | ||
'PhpCsFixerGoodFixers/interface_method_php_doc_summary' => true, | ||
'PhpCsFixerGoodFixers/disable_function' => true, | ||
'PhpCsFixerGoodFixers/laravel_command_no_empty_description' => true, | ||
'mb_str_functions' => true, | ||
]) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## Laravel RuCurrency | ||
|
||
![PHP Composer](https://github.com/ArtARTs36/laravel-ru-currency/workflows/Testing/badge.svg?branch=master) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
<a href="https://poser.pugx.org/artarts36/laravel-ru-currency/d/total.svg"> | ||
<img src="https://poser.pugx.org/artarts36/laravel-ru-currency/d/total.svg" alt="Total Downloads"> | ||
</a> | ||
|
||
This package provides currencies with courses For Laravel | ||
|
||
## Installation | ||
|
||
1. Run: `composer require artarts36/laravel-ru-currency` | ||
2. Add provider `ArtARTs36\LaravelRuCurrency\Provider\CurrencyProvider::class` into your providers in app.php | ||
3. Run: `php artisan migrate` | ||
4. Run: `php artisan db:seed --class="\ArtARTs36\LaravelRuCurrency\Database\Seeders\RuCurrencySeeder"` | ||
5. Run: `php artisan ru-currency:fetch-courses` | ||
|
||
If you see the error `Target [Psr\Http\Client\ClientInterface] is not instantiable while building [ArtARTs36\LaravelRuCurrency\Operation\Course\Fetcher\CourseFetcher, ArtARTs36\CbrCourseFinder\Finder]`, then add the following line to your provider: | ||
```php | ||
$this->app->bind(ClientInterface::class, \GuzzleHttp\Client::class); | ||
``` | ||
|
||
## Commands for Application | ||
|
||
| Command | Description | | ||
|---------------------------------------------|------------------------------| | ||
| ru-currency:fetch-courses | Fetch actual courses | | ||
| ru-currency:fetch-courses --date=2020-02-03 | Fetch actual courses at date | | ||
|
||
## Development Console | ||
|
||
| Command | Description | | ||
|-----------------------|------------------------------------| | ||
| composer lint | Check code on PSR (PHP CS Sniffer) | | ||
| composer stat-analyse | Run stat-analyse (PHPStan) | | ||
| composer test | Run tests (PHPUnit) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
includes: | ||
- ./vendor/nunomaduro/larastan/extension.neon | ||
|
||
parameters: | ||
|
||
paths: | ||
- src | ||
|
||
level: 8 | ||
|
||
checkMissingIterableValueType: false | ||
|
||
checkGenericClassInNonGenericObjectType: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">src/</directory> | ||
</include> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name=":service_name Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="APP_ENV" value="testing"/> | ||
<env name="BCRYPT_ROUNDS" value="4"/> | ||
<env name="CACHE_DRIVER" value="array"/> | ||
<env name="SESSION_DRIVER" value="array"/> | ||
<env name="QUEUE_DRIVER" value="sync"/> | ||
<env name="MAIL_DRIVER" value="array"/> | ||
<env name="DB_CONNECTION" value="sqlite"/> | ||
<env name="DB_DATABASE" value=":memory:"/> | ||
</php> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\LaravelRuCurrency\Contracts; | ||
|
||
interface CourseCreatingException extends \Throwable | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\LaravelRuCurrency\Contracts; | ||
|
||
use ArtARTs36\CbrCourseFinder\Data\CourseBag; | ||
|
||
interface CourseCreator | ||
{ | ||
/** | ||
* Create courses from external data. | ||
* @return int - count of created courses | ||
* @throws CourseCreatingException | ||
*/ | ||
public function create(CourseBag $courses): int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\LaravelRuCurrency\Contracts; | ||
|
||
use ArtARTs36\CbrCourseFinder\Contracts\SearchException; | ||
|
||
interface CourseFetcher | ||
{ | ||
/** | ||
* Fetch courses at date. | ||
* @throws CourseCreatingException | ||
* @throws SearchException | ||
*/ | ||
public function fetchAt(\DateTimeInterface $date): int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace ArtARTs36\LaravelRuCurrency\Contracts; | ||
|
||
interface CourseRepository | ||
{ | ||
/** | ||
* Insert courses. | ||
* @param array<array<string, mixed>> $values | ||
*/ | ||
public function insertOrIgnore(array $values): int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.