@@ -15,7 +15,6 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Create a new event instance. |
| 17 | 17 | * |
| 18 | - * @param Order $order |
|
| 19 | 18 | * @return void |
| 20 | 19 | */ |
| 21 | 20 | public function __construct(Response $paymentResponse) |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | |
| 8 | 8 | namespace HazeStudio\LaravelGoPaySDK; |
| 9 | 9 | |
| 10 | -use HazeStudio\LaravelGoPaySDK\Events\PaymentCreated; |
|
| 11 | 10 | use Illuminate\Support\ServiceProvider; |
| 12 | 11 | |
| 13 | 12 | class GopayServiceProvider extends ServiceProvider |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function register() |
| 33 | 33 | {
|
| 34 | - if(is_dir($vendor = __DIR__.'/../vendor')){
|
|
| 34 | + if (is_dir($vendor = __DIR__.'/../vendor')) {
|
|
| 35 | 35 | require_once $vendor.'/autoload.php'; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | __DIR__.'/config.php', 'gopay' |
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - $this->app->singleton('GopaySDK', function ($app) {
|
|
| 42 | + $this->app->singleton('GopaySDK', function($app) {
|
|
| 43 | 43 | return new GoPaySDK(); |
| 44 | 44 | }); |
| 45 | 45 | } |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $fallback = config('app.fallback_locale');
|
| 35 | 35 | |
| 36 | - if(isset(config('gopay.languages')[\App::getLocale()])){
|
|
| 36 | + if (isset(config('gopay.languages')[\App::getLocale()])) {
|
|
| 37 | 37 | $language = config('gopay.languages')[\App::getLocale()];
|
| 38 | 38 | } else {
|
| 39 | 39 | $language = config('gopay.languages')[$fallback];
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(defined($langConst = 'GoPay\Definition\Language::'.$language)) {
|
|
| 42 | + if (defined($langConst = 'GoPay\Definition\Language::'.$language)) {
|
|
| 43 | 43 | $this->config['language'] = constant($langConst); |
| 44 | 44 | } else {
|
| 45 | 45 | $this->config['language'] = GoPay\Definition\Language::ENGLISH; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if(defined($scopeConst = 'GoPay\Definition\TokenScope::'.config('gopay.defaultScope'))){
|
|
| 48 | + if (defined($scopeConst = 'GoPay\Definition\TokenScope::'.config('gopay.defaultScope'))) {
|
|
| 49 | 49 | $this->config['scope'] = constant($scopeConst); |
| 50 | 50 | } else {
|
| 51 | 51 | $this->config['scope'] = GoPay\Definition\TokenScope::CREATE_PAYMENT; |
@@ -60,25 +60,25 @@ discard block |
||
| 60 | 60 | protected function initGoPay() |
| 61 | 61 | {
|
| 62 | 62 | $this->gopay = GoPay\Api::payments($this->config, $this->services); |
| 63 | - if($this->needReInit) |
|
| 63 | + if ($this->needReInit) |
|
| 64 | 64 | $this->needReInit = false; |
| 65 | 65 | return $this->gopay; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function __call($name, $arguments) |
| 69 | 69 | {
|
| 70 | - if(method_exists($this, $name)) |
|
| 70 | + if (method_exists($this, $name)) |
|
| 71 | 71 | {
|
| 72 | 72 | return $this->{$name}(...$arguments);
|
| 73 | - } else if(method_exists($this->gopay, $name)){
|
|
| 74 | - if($this->needReInit){
|
|
| 73 | + } else if (method_exists($this->gopay, $name)) {
|
|
| 74 | + if ($this->needReInit) {
|
|
| 75 | 75 | $gp = $this->initGoPay(); |
| 76 | 76 | } else {
|
| 77 | 77 | $gp = $this->gopay; |
| 78 | 78 | } |
| 79 | 79 | $methodResult = $gp->{$name}(...$arguments);
|
| 80 | 80 | |
| 81 | - switch ($name){
|
|
| 81 | + switch ($name) {
|
|
| 82 | 82 | case 'createPayment': |
| 83 | 83 | event(new PaymentCreated($methodResult)); |
| 84 | 84 | break; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function scope($scope) |
| 95 | 95 | {
|
| 96 | - if(defined($scopeConst = 'GoPay\Definition\TokenScope::'.$scope)) |
|
| 96 | + if (defined($scopeConst = 'GoPay\Definition\TokenScope::'.$scope)) |
|
| 97 | 97 | {
|
| 98 | 98 | $this->config['scope'] = constant($scopeConst); |
| 99 | 99 | } else {
|
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | public function lang($lang) |
| 107 | 107 | {
|
| 108 | - if(defined($langConst = 'GoPay\Definition\Language::'.$lang)) |
|
| 108 | + if (defined($langConst = 'GoPay\Definition\Language::'.$lang)) |
|
| 109 | 109 | {
|
| 110 | 110 | $this->config['language'] = constant($langConst); |
| 111 | - } else if(isset(config('gopay.languages')[$lang]) && defined($langConst = 'GoPay\Definition\Language::'.config('gopay.languages')[$lang])) {
|
|
| 111 | + } else if (isset(config('gopay.languages')[$lang]) && defined($langConst = 'GoPay\Definition\Language::'.config('gopay.languages')[$lang])) {
|
|
| 112 | 112 | $this->config['language'] = constant($langConst); |
| 113 | 113 | } else {
|
| 114 | 114 | $this->config['language'] = $lang; |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function logHttpCommunication($request, $response) |
| 121 | 121 | {
|
| 122 | - if($this->logClosure == null) {
|
|
| 122 | + if ($this->logClosure == null) {
|
|
| 123 | 123 | |
| 124 | 124 | $this->logsBefore[] = [$request, $response]; |
| 125 | - }else{
|
|
| 125 | + } else {
|
|
| 126 | 126 | call_user_func($this->logClosure, $request, $response); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | {
|
| 132 | 132 | $this->logClosure = $closure; |
| 133 | 133 | |
| 134 | - foreach($this->logsBefore as $log) |
|
| 134 | + foreach ($this->logsBefore as $log) |
|
| 135 | 135 | {
|
| 136 | 136 | call_user_func_array($this->logClosure, $log); |
| 137 | 137 | } |
@@ -60,8 +60,9 @@ discard block |
||
| 60 | 60 | protected function initGoPay() |
| 61 | 61 | {
|
| 62 | 62 | $this->gopay = GoPay\Api::payments($this->config, $this->services); |
| 63 | - if($this->needReInit) |
|
| 64 | - $this->needReInit = false; |
|
| 63 | + if($this->needReInit) {
|
|
| 64 | + $this->needReInit = false; |
|
| 65 | + } |
|
| 65 | 66 | return $this->gopay; |
| 66 | 67 | } |
| 67 | 68 | |
@@ -122,7 +123,7 @@ discard block |
||
| 122 | 123 | if($this->logClosure == null) {
|
| 123 | 124 | |
| 124 | 125 | $this->logsBefore[] = [$request, $response]; |
| 125 | - }else{
|
|
| 126 | + } else{
|
|
| 126 | 127 | call_user_func($this->logClosure, $request, $response); |
| 127 | 128 | } |
| 128 | 129 | } |