Completed
Push — master ( b7b816...25a801 )
by Zura
01:24
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/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.
src/Promocodes.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
         $this->codes = Promocode::pluck('code')->toArray();
49 49
         $this->length = substr_count(config('promocodes.mask'), '*');
50 50
 
51
-        $this->prefix = (bool)config('promocodes.prefix')
52
-            ? config('promocodes.prefix') . config('promocodes.separator')
51
+        $this->prefix = (bool) config('promocodes.prefix')
52
+            ? config('promocodes.prefix').config('promocodes.separator')
53 53
             : '';
54 54
 
55
-        $this->suffix = (bool)config('promocodes.suffix')
56
-            ? config('promocodes.separator') . config('promocodes.suffix')
55
+        $this->suffix = (bool) config('promocodes.suffix')
56
+            ? config('promocodes.separator').config('promocodes.suffix')
57 57
             : '';
58 58
     }
59 59
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         }
119 119
 
120 120
         if (Promocode::insert($records)) {
121
-            return collect($records)->map(function ($record) {
121
+            return collect($records)->map(function($record) {
122 122
                 $record['data'] = json_decode($record['data'], true);
123 123
 
124 124
                 return $record;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      */
341 341
     public function clearRedundant()
342 342
     {
343
-        Promocode::all()->each(function (Promocode $promocode) {
343
+        Promocode::all()->each(function(Promocode $promocode) {
344 344
             if ($promocode->isExpired() || ($promocode->isDisposable() && $promocode->users()->exists()) || $promocode->isOverAmount()) {
345 345
                 $promocode->users()->detach();
346 346
                 $promocode->delete();
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
      */
356 356
     public function all()
357 357
     {
358
-        return Promocode::all()->filter(function (Promocode $promocode) {
358
+        return Promocode::all()->filter(function(Promocode $promocode) {
359 359
             return !$promocode->isExpired() && !($promocode->isDisposable() && $promocode->users()->exists()) && !$promocode->isOverAmount();
360 360
         });
361 361
     }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      * Your code will be validated to be unique for one request.
254 254
      *
255 255
      * @param $collection
256
-     * @param $new
256
+     * @param string $new
257 257
      *
258 258
      * @return bool
259 259
      */
@@ -288,7 +288,6 @@  discard block
 block discarded – undo
288 288
     /**
289 289
      * Get custom set data value
290 290
      *
291
-     * @param null|array $data
292 291
      * @return null|array
293 292
      */
294 293
     public function getData($request)
@@ -456,7 +455,7 @@  discard block
 block discarded – undo
456 455
      *
457 456
      * @param string $code
458 457
      *
459
-     * @return bool|Promocode
458
+     * @return Promocode
460 459
      */
461 460
     public function check($code)
462 461
     {
Please login to merge, or discard this patch.
tests/ApplyPromocodeToUserTest.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Gabievi\Promocodes\Models\Promocode;
6 6
 use Gabievi\Promocodes\Tests\Models\User;
7 7
 use Gabievi\Promocodes\Facades\Promocodes;
8
-use Gabievi\Promocodes\Exceptions\AlreadyUsedException;
9 8
 use Gabievi\Promocodes\Exceptions\UnauthenticatedException;
10 9
 
11 10
 class ApplyPromocodeToUserTest extends TestCase
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->increments('id');
30 30
 
31 31
             $table->unsignedBigInteger('user_id');
Please login to merge, or discard this patch.