Completed
Pull Request — master (#19)
by Leandro
16:59
created
src/Promocodes.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
      * Your code will be validated to be unique for one request.
94 94
      *
95 95
      * @param $collection
96
-     * @param $new
96
+     * @param string $new
97 97
      *
98 98
      * @return bool
99 99
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         }
89 89
 
90 90
         if (Promocode::insert($records)) {
91
-            return collect($records)->map(function ($record) {
91
+            return collect($records)->map(function($record) {
92 92
                 $record['data'] = json_decode($record['data'], true);
93 93
                 return $record;
94 94
             });
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
                 return $promocode->load('users');
165 165
             }
166
-        } catch(InvalidPromocodeExceprion $exception) {
166
+        } catch (InvalidPromocodeExceprion $exception) {
167 167
             //
168 168
         }
169 169
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function clearRedundant()
213 213
     {
214
-        Promocode::all()->each(function ($promocode) {
214
+        Promocode::all()->each(function($promocode) {
215 215
             if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists())) {
216 216
                 $promocode->users()->detach();
217 217
                 $promocode->delete();
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
      */
265 265
     private function getPrefix()
266 266
     {
267
-        return (bool)config('promocodes.prefix')
268
-            ? config('promocodes.prefix') . config('promocodes.separator')
267
+        return (bool) config('promocodes.prefix')
268
+            ? config('promocodes.prefix').config('promocodes.separator')
269 269
             : '';
270 270
     }
271 271
 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
      */
277 277
     private function getSuffix()
278 278
     {
279
-        return (bool)config('promocodes.suffix')
280
-            ? config('promocodes.separator') . config('promocodes.suffix')
279
+        return (bool) config('promocodes.suffix')
280
+            ? config('promocodes.separator').config('promocodes.suffix')
281 281
             : '';
282 282
     }
283 283
 
Please login to merge, or discard this patch.
src/PromocodesServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 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/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.