Completed
Push — master ( 28491f...b65575 )
by Zura
01:31
created
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
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         }
96 96
 
97 97
         if (Promocode::insert($records)) {
98
-            return collect($records)->map(function ($record) {
98
+            return collect($records)->map(function($record) {
99 99
                 $record['data'] = json_decode($record['data'], true);
100 100
 
101 101
                 return $record;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public function clearRedundant()
236 236
     {
237
-        Promocode::all()->each(function (Promocode $promocode) {
237
+        Promocode::all()->each(function(Promocode $promocode) {
238 238
             if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists()) || $promocode->isOverAmount()) {
239 239
                 $promocode->users()->detach();
240 240
                 $promocode->delete();
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function all()
251 251
     {
252
-        return Promocode::all()->filter(function (Promocode $promocode) {
252
+        return Promocode::all()->filter(function(Promocode $promocode) {
253 253
             return !$promocode->isExpired() && !($promocode->isDisposable() && $promocode->users()->exists()) && !$promocode->isOverAmount();
254 254
         });
255 255
     }
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
      */
294 294
     private function getPrefix()
295 295
     {
296
-        return (bool)config('promocodes.prefix')
297
-            ? config('promocodes.prefix') . config('promocodes.separator')
296
+        return (bool) config('promocodes.prefix')
297
+            ? config('promocodes.prefix').config('promocodes.separator')
298 298
             : '';
299 299
     }
300 300
 
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
      */
306 306
     private function getSuffix()
307 307
     {
308
-        return (bool)config('promocodes.suffix')
309
-            ? config('promocodes.separator') . config('promocodes.suffix')
308
+        return (bool) config('promocodes.suffix')
309
+            ? config('promocodes.separator').config('promocodes.suffix')
310 310
             : '';
311 311
     }
312 312
 
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,14 +14,14 @@  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
         if (!class_exists('CreatePromocodesTable')) {
21 21
             $timestamp = date('Y_m_d_His', time());
22 22
 
23 23
             $this->publishes([
24
-                __DIR__ . '/../migrations/create_promocodes_table.php.stub' => database_path("/migrations/{$timestamp}_create_promocodes_table.php"),
24
+                __DIR__.'/../migrations/create_promocodes_table.php.stub' => database_path("/migrations/{$timestamp}_create_promocodes_table.php"),
25 25
             ], 'migrations');
26 26
         }
27 27
     }
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     public function register()
35 35
     {
36 36
         $this->mergeConfigFrom(
37
-            __DIR__ . '/../config/promocodes.php', 'promocodes'
37
+            __DIR__.'/../config/promocodes.php', 'promocodes'
38 38
         );
39 39
 
40
-        $this->app->singleton('promocodes', function ($app) {
40
+        $this->app->singleton('promocodes', function($app) {
41 41
             return new Promocodes();
42 42
         });
43 43
     }
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('promocodes', function (Blueprint $table) {
15
+        Schema::create('promocodes', function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
 
18 18
             $table->string('code', 32)->unique();
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             $table->timestamp('expires_at')->nullable();
26 26
         });
27 27
 
28
-        Schema::create('promocode_user', function (Blueprint $table) {
28
+        Schema::create('promocode_user', function(Blueprint $table) {
29 29
             $table->unsignedBigInteger('user_id');
30 30
             $table->unsignedBigInteger('promocode_id');
31 31
 
Please login to merge, or discard this patch.