-
Notifications
You must be signed in to change notification settings - Fork 136
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
6 changed files
with
146 additions
and
104 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,17 +1,14 @@ | ||
language: php | ||
|
||
php: | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
matrix: | ||
allow_failures: | ||
- php: 7.0 | ||
|
||
before_script: | ||
- curl -s http://getcomposer.org/installer | php | ||
- php composer.phar install --dev | ||
|
||
script: phpunit | ||
language: php | ||
|
||
php: | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
|
||
before_script: | ||
- curl -s http://getcomposer.org/installer | php | ||
- php composer.phar install --dev | ||
|
||
script: | ||
- ./vendor/bin/phpcs --standard=phpcs.xml src | ||
- ./vendor/bin/phpstan --level=0 --no-progress analyse src |
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,26 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PSR2-package"> | ||
<description>The PSR2 standard</description> | ||
|
||
<!-- use preg_match https://github.com/squizlabs/PHP_CodeSniffer/issues/742#issuecomment-215250517 --> | ||
<exclude-pattern>/resources/</exclude-pattern> | ||
<exclude-pattern>/vendor/</exclude-pattern> | ||
<exclude-pattern>/_[a-zA-Z0-9\._]+\.php</exclude-pattern> | ||
<exclude-pattern>/\.[a-zA-Z0-9\._]+\.php</exclude-pattern> | ||
<exclude-pattern>\.git</exclude-pattern> | ||
|
||
<!-- Include the whole PSR2 standard --> | ||
<rule ref="PSR2"> | ||
<exclude name="PSR1.Methods.CamelCapsMethodName"/> | ||
<exclude name="PSR2.Files.EndFileNewline"/> | ||
<exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/> | ||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/> | ||
</rule> | ||
|
||
<!-- Lines can be longer --> | ||
<rule ref="Generic.Files.LineLength"> | ||
<properties> | ||
<property name="lineLimit" value="9999"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
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,10 @@ | ||
parameters: | ||
excludes_analyse: | ||
- vendor | ||
- resources | ||
ignoreErrors: | ||
- '#Function app not found#' | ||
- '#Function config_path not found#' | ||
- '#Function base_path not found#' | ||
- '#Function config not found#' | ||
- '#Parameter \$request of method#' |
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 |
---|---|---|
@@ -1,85 +1,85 @@ | ||
<?php | ||
|
||
namespace Torann\Currency; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use Illuminate\Support\Str; | ||
|
||
class CurrencyServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->registerCurrency(); | ||
|
||
if ($this->app->runningInConsole()) { | ||
$this->registerResources(); | ||
$this->registerCurrencyCommands(); | ||
} | ||
} | ||
|
||
/** | ||
* Register currency provider. | ||
* | ||
* @return void | ||
*/ | ||
public function registerCurrency() | ||
{ | ||
$this->app->singleton('currency', function ($app) { | ||
return new Currency( | ||
$app->config->get('currency', []), | ||
$app['cache'] | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Register currency resources. | ||
* | ||
* @return void | ||
*/ | ||
public function registerResources() | ||
{ | ||
if ($this->isLumen() === false) { | ||
$this->publishes([ | ||
__DIR__ . '/../config/currency.php' => config_path('currency.php'), | ||
], 'config'); | ||
|
||
$this->mergeConfigFrom( | ||
__DIR__ . '/../config/currency.php', 'currency' | ||
); | ||
} | ||
|
||
$this->publishes([ | ||
__DIR__ . '/../database/migrations' => base_path('/database/migrations'), | ||
], 'migrations'); | ||
} | ||
|
||
/** | ||
* Register currency commands. | ||
* | ||
* @return void | ||
*/ | ||
public function registerCurrencyCommands() | ||
{ | ||
$this->commands([ | ||
Console\Cleanup::class, | ||
Console\Manage::class, | ||
Console\Update::class, | ||
]); | ||
} | ||
|
||
/** | ||
* Check if package is running under Lumen app | ||
* | ||
* @return bool | ||
*/ | ||
protected function isLumen() | ||
{ | ||
return Str::contains($this->app->version(), 'Lumen') === true; | ||
} | ||
} | ||
<?php | ||
|
||
namespace Torann\Currency; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use Illuminate\Support\Str; | ||
|
||
class CurrencyServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->registerCurrency(); | ||
|
||
if ($this->app->runningInConsole()) { | ||
$this->registerResources(); | ||
$this->registerCurrencyCommands(); | ||
} | ||
} | ||
|
||
/** | ||
* Register currency provider. | ||
* | ||
* @return void | ||
*/ | ||
public function registerCurrency() | ||
{ | ||
$this->app->singleton('currency', function ($app) { | ||
return new Currency( | ||
$app->config->get('currency', []), | ||
$app['cache'] | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Register currency resources. | ||
* | ||
* @return void | ||
*/ | ||
public function registerResources() | ||
{ | ||
if ($this->isLumen() === false) { | ||
$this->publishes([ | ||
__DIR__ . '/../config/currency.php' => config_path('currency.php'), | ||
], 'config'); | ||
|
||
$this->mergeConfigFrom( | ||
__DIR__ . '/../config/currency.php', 'currency' | ||
); | ||
} | ||
|
||
$this->publishes([ | ||
__DIR__ . '/../database/migrations' => base_path('/database/migrations'), | ||
], 'migrations'); | ||
} | ||
|
||
/** | ||
* Register currency commands. | ||
* | ||
* @return void | ||
*/ | ||
public function registerCurrencyCommands() | ||
{ | ||
$this->commands([ | ||
Console\Cleanup::class, | ||
Console\Manage::class, | ||
Console\Update::class, | ||
]); | ||
} | ||
|
||
/** | ||
* Check if package is running under Lumen app | ||
* | ||
* @return bool | ||
*/ | ||
protected function isLumen() | ||
{ | ||
return Str::contains($this->app->version(), 'Lumen') === true; | ||
} | ||
} |