Completed
Pull Request — master (#37)
by
unknown
02:14
created
migrations/2016_05_17_221000_create_promocodes_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create(config('promocodes.table', 'promocodes'), function (Blueprint $table) {
15
+        Schema::create(config('promocodes.table', 'promocodes'), function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
 
18 18
             $table->string('code', 32)->unique();
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
             $table->timestamp('expires_at')->nullable();
25 25
         });
26 26
 
27
-        Schema::create(config('promocodes.relation_table', 'promocode_user'), function (Blueprint $table) {
27
+        Schema::create(config('promocodes.relation_table', 'promocode_user'), function(Blueprint $table) {
28 28
             $table->unsignedInteger('user_id');
29 29
             $table->unsignedInteger('promocode_id');
30 30
             
Please login to merge, or discard this patch.
tests/RewardableTraitTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /** @test */
33 33
     public function it_returns_null_in_callback_if_could_not_apply_promocode()
34 34
     {
35
-        $this->user->applyCode('INVALID-CODE', function ($applyCode) {
35
+        $this->user->applyCode('INVALID-CODE', function($applyCode) {
36 36
             $this->assertNull($applyCode);
37 37
         });
38 38
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         $this->assertCount(1, $promocodes);
93 93
 
94
-        $this->user->applyCode($promocode['code'], function ($appliedPromocode) {
94
+        $this->user->applyCode($promocode['code'], function($appliedPromocode) {
95 95
             $this->assertTrue($appliedPromocode instanceof Promocode);
96 96
         });
97 97
     }
Please login to merge, or discard this patch.
src/Promocodes.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @param string $code
121 121
      *
122
-     * @return bool|Promocode
122
+     * @return Promocode
123 123
      * @throws InvalidPromocodeException
124 124
      */
125 125
     public function check($code)
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * Your code will be validated to be unique for one request.
283 283
      *
284 284
      * @param $collection
285
-     * @param $new
285
+     * @param string $new
286 286
      *
287 287
      * @return bool
288 288
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         if (Promocode::insert($records)) {
92
-            return collect($records)->map(function ($record) {
92
+            return collect($records)->map(function($record) {
93 93
                 $record['data'] = json_decode($record['data'], true);
94 94
 
95 95
                 return $record;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     'used_at' => Carbon::now(),
167 167
                 ]);
168 168
 
169
-                if(!is_null($promocode->amount_codes)){
169
+                if (!is_null($promocode->amount_codes)) {
170 170
                     $promocode->amount_codes -= 1;
171 171
                     $promocode->save();
172 172
                 }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function clearRedundant()
225 225
     {
226
-        Promocode::all()->each(function (Promocode $promocode) {
226
+        Promocode::all()->each(function(Promocode $promocode) {
227 227
             if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists()) || $promocode->isOverAmount()) {
228 228
                 $promocode->users()->detach();
229 229
                 $promocode->delete();
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
      */
271 271
     private function getPrefix()
272 272
     {
273
-        return (bool)config('promocodes.prefix')
274
-            ? config('promocodes.prefix') . config('promocodes.separator')
273
+        return (bool) config('promocodes.prefix')
274
+            ? config('promocodes.prefix').config('promocodes.separator')
275 275
             : '';
276 276
     }
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
      */
283 283
     private function getSuffix()
284 284
     {
285
-        return (bool)config('promocodes.suffix')
286
-            ? config('promocodes.separator') . config('promocodes.suffix')
285
+        return (bool) config('promocodes.suffix')
286
+            ? config('promocodes.separator').config('promocodes.suffix')
287 287
             : '';
288 288
     }
289 289
 
Please login to merge, or discard this patch.
src/PromocodesServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
     public function boot()
15 15
     {
16 16
         $this->publishes([
17
-            __DIR__ . '/../config/promocodes.php' => config_path('promocodes.php'),
17
+            __DIR__.'/../config/promocodes.php' => config_path('promocodes.php'),
18 18
         ]);
19 19
 
20 20
         $this->publishes([
21
-            __DIR__ . '/../migrations' => database_path('migrations'),
21
+            __DIR__.'/../migrations' => database_path('migrations'),
22 22
         ], 'migrations');
23 23
     }
24 24
 
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
     public function register()
31 31
     {
32 32
         $this->mergeConfigFrom(
33
-            __DIR__ . '/../config/promocodes.php', 'promocodes'
33
+            __DIR__.'/../config/promocodes.php', 'promocodes'
34 34
         );
35 35
 
36
-        $this->app->singleton('promocodes', function ($app) {
36
+        $this->app->singleton('promocodes', function($app) {
37 37
             return new Promocodes();
38 38
         });
39 39
     }
Please login to merge, or discard this patch.
migrations/2018_10_22_221099_add_amount_codes_row.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::table(config('promocodes.table', 'promocodes'), function (Blueprint $table) {
15
+        Schema::table(config('promocodes.table', 'promocodes'), function(Blueprint $table) {
16 16
             $table->integer('amount_codes')->nullable();
17 17
         });
18 18
     }
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function down()
26 26
     {
27
-        Schema::table(config('promocodes.table', 'promocodes'), function (Blueprint $table) {
27
+        Schema::table(config('promocodes.table', 'promocodes'), function(Blueprint $table) {
28 28
             $table->dropColumn('amount_codes');
29 29
         });
30 30
     }
Please login to merge, or discard this patch.
src/Models/Promocode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
      */
141 141
     public function isOverAmount()
142 142
     {
143
-        if(is_null($this->amount_codes)){
143
+        if (is_null($this->amount_codes)) {
144 144
             return false;
145 145
         }
146 146
 
Please login to merge, or discard this patch.
src/Traits/Rewardable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
                     'used_at' => Carbon::now(),
44 44
                 ]);
45 45
 
46
-                if(!is_null($promocode->amount_codes)){
46
+                if (!is_null($promocode->amount_codes)) {
47 47
                     $promocode->amount_codes -= 1;
48 48
                     $promocode->save();
49 49
                 }
Please login to merge, or discard this patch.