Passed
Push — master ( 740cbb...93b814 )
by Vinicius Lourenço
03:07
created
src/Scheduler/Exceptions/CustomException.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,8 +88,9 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function parseValues()
90 90
     {
91
-        if(is_array($this->attributes) && is_array($this->values))
92
-            return collect($this->attributes)->combine($this->values)->all();
91
+        if(is_array($this->attributes) && is_array($this->values)) {
92
+                    return collect($this->attributes)->combine($this->values)->all();
93
+        }
93 94
 
94 95
         return [ $this->attributes => $this->values ?? $this->isLower() ];
95 96
     }
@@ -111,8 +112,9 @@  discard block
 block discarded – undo
111 112
      */
112 113
     protected function getAlias()
113 114
     {
114
-        if(is_object($this->model))
115
-            $this->model = get_class($this->model);
115
+        if(is_object($this->model)) {
116
+                    $this->model = get_class($this->model);
117
+        }
116 118
 
117 119
         return collect(trans('scheduler::exceptions.aliases.'. $this->aliastype))->search($this->model) ?: 'Recurso';
118 120
     }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @param mixed $model
66 66
      */
67
-    public function __construct($model = 'foo')
67
+    public function __construct ($model = 'foo')
68 68
     {
69 69
         $this->model = $model;
70 70
     }
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return \Illuminate\Http\JsonResponse
76 76
      */
77
-    public function render()
77
+    public function render ()
78 78
     {
79 79
         return response()->
80 80
             /** @scrutinizer ignore-call */
81 81
             json([
82
-            'messages' => trans('scheduler::exceptions.'. $this->trans, $this->parseValues())
82
+            'messages' => trans('scheduler::exceptions.' . $this->trans, $this->parseValues())
83 83
         ], $this->statusCode);
84 84
     }
85 85
 
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      *
89 89
      * @return array
90 90
      */
91
-    protected function parseValues()
91
+    protected function parseValues ()
92 92
     {
93
-        if(is_array($this->attributes) && is_array($this->values))
93
+        if (is_array($this->attributes) && is_array($this->values))
94 94
             return collect($this->attributes)->combine($this->values)->all();
95 95
 
96 96
         return [ $this->attributes => $this->values ?? $this->isLower() ];
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return string
103 103
      */
104
-    protected function isLower()
104
+    protected function isLower ()
105 105
     {
106 106
         return $this->lowercase ? strtolower($this->getAlias()) : $this->getAlias();
107 107
     }
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @return string
113 113
      */
114
-    protected function getAlias()
114
+    protected function getAlias ()
115 115
     {
116
-        if(is_object($this->model))
116
+        if (is_object($this->model))
117 117
             $this->model = get_class($this->model);
118 118
 
119
-        return collect(trans('scheduler::exceptions.aliases.'. $this->aliastype))->search($this->model) ?: 'Recurso';
119
+        return collect(trans('scheduler::exceptions.aliases.' . $this->aliastype))->search($this->model) ?: 'Recurso';
120 120
     }
121 121
 
122 122
     /**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @param mixed $values
126 126
      */
127
-    public function setValues($values)
127
+    public function setValues ($values)
128 128
     {
129 129
         $this->values = $values;
130 130
 
Please login to merge, or discard this patch.
src/Scheduler/SchedulerServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
      *
18 18
      * @return void
19 19
      */
20
-    public function boot()
20
+    public function boot ()
21 21
     {
22 22
         $this->publishes([
23
-            __DIR__.'/../config/config.php' => config_path('scheduler.php'),
23
+            __DIR__ . '/../config/config.php' => config_path('scheduler.php'),
24 24
         ]);
25 25
 
26
-        $this->loadMigrationsFrom(__DIR__.'/Migrations');
27
-        $this->loadTranslationsFrom(__DIR__.'/Translations', 'scheduler');
26
+        $this->loadMigrationsFrom(__DIR__ . '/Migrations');
27
+        $this->loadTranslationsFrom(__DIR__ . '/Translations', 'scheduler');
28 28
 
29 29
         $this->publishes([
30
-            __DIR__.'/Translations' => resource_path('lang/vendor/scheduler'),
30
+            __DIR__ . '/Translations' => resource_path('lang/vendor/scheduler'),
31 31
         ]);
32 32
     }
33 33
 
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return void
38 38
      */
39
-    public function register()
39
+    public function register ()
40 40
     {
41
-        $this->app->singleton(Scheduler::class, function ($app) {
41
+        $this->app->singleton(Scheduler::class, function($app) {
42 42
             return new Scheduler($app);
43 43
         });
44 44
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return void
54 54
      */
55
-    private function mergeConfig()
55
+    private function mergeConfig ()
56 56
     {
57 57
         $this->mergeConfigFrom(
58
-            __DIR__.'/../config/config.php', 'scheduler'
58
+            __DIR__ . '/../config/config.php', 'scheduler'
59 59
         );
60 60
     }
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scheduler/Models/ScheduleStatus.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     /**
38 38
      * Construtor para inicilizar a váriavel table.
39 39
      */
40
-    public function __construct(array $attributes = [])
40
+    public function __construct (array $attributes = [ ])
41 41
     {
42 42
         parent::__construct($attributes);
43 43
 
Please login to merge, or discard this patch.
src/Scheduler/Facades/Scheduler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      *
25 25
      * @return string
26 26
      */
27
-    protected static function getFacadeAccessor()
27
+    protected static function getFacadeAccessor ()
28 28
     {
29 29
         return 'scheduler';
30 30
     }
Please login to merge, or discard this patch.
src/Scheduler/Models/Schedule.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @param int|string $status Pode ser passado o ID do status ou seu nome para seta-lo no horário.
46 46
      */
47
-    public function setStatus($name)
47
+    public function setStatus ($name)
48 48
     {
49 49
     	$this->fill($this->parseStatusKey($name))->save();
50 50
     }
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @throws \H4ad\Scheduler\Exceptions\ModelNotFound
59 59
      */
60
-    public function parseStatusKey($status)
60
+    public function parseStatusKey ($status)
61 61
     {
62
-    	if(is_int($status))
63
-    		$status =  ScheduleStatus::find($status);
62
+    	if (is_int($status))
63
+    		$status = ScheduleStatus::find($status);
64 64
 
65
-        if(is_string($status))
65
+        if (is_string($status))
66 66
         	$status = ScheduleStatus::where('name', $status)->first();
67 67
 
68
-    	if(is_null($status))
68
+    	if (is_null($status))
69 69
     		throw (new ModelNotFound)->setValues(ScheduleStatus::class);
70 70
 
71
-    	return ['status' => $status->id];
71
+    	return [ 'status' => $status->id ];
72 72
     }
73 73
 
74 74
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param \Carbon\Carbon|string $start_at
79 79
      * @return \Illuminate\Database\Eloquent\Builder
80 80
      */
81
-    public function scopeByStartAt($query, $start_at)
81
+    public function scopeByStartAt ($query, $start_at)
82 82
     {
83 83
         return $query->where('start_at', $start_at);
84 84
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,14 +59,17 @@
 block discarded – undo
59 59
      */
60 60
     public function parseStatusKey($status)
61 61
     {
62
-    	if(is_int($status))
63
-    		$status =  ScheduleStatus::find($status);
62
+    	if(is_int($status)) {
63
+    	    		$status =  ScheduleStatus::find($status);
64
+    	}
64 65
 
65
-        if(is_string($status))
66
-        	$status = ScheduleStatus::where('name', $status)->first();
66
+        if(is_string($status)) {
67
+                	$status = ScheduleStatus::where('name', $status)->first();
68
+        }
67 69
 
68
-    	if(is_null($status))
69
-    		throw (new ModelNotFound)->setValues(ScheduleStatus::class);
70
+    	if(is_null($status)) {
71
+    	    		throw (new ModelNotFound)->setValues(ScheduleStatus::class);
72
+    	}
70 73
 
71 74
     	return ['status' => $status->id];
72 75
     }
Please login to merge, or discard this patch.
src/Scheduler/Migrations/2018_08_18_225944_create_schedules_table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @return void
22 22
      */
23
-    public function up()
23
+    public function up ()
24 24
     {
25
-        Schema::create(Config::get('scheduler.schedules_table'), function (Blueprint $table) {
25
+        Schema::create(Config::get('scheduler.schedules_table'), function(Blueprint $table) {
26 26
             $table->increments('id');
27 27
             $table->string('model_type');
28 28
             $table->integer('model_id');
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @return void
41 41
      */
42
-    public function down()
42
+    public function down ()
43 43
     {
44 44
         Schema::drop(Config::get('scheduler.schedules_table'));
45 45
     }
Please login to merge, or discard this patch.
src/Scheduler/Migrations/2018_08_18_225643_create_schedule_status_table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @return void
22 22
      */
23
-    public function up()
23
+    public function up ()
24 24
     {
25
-        Schema::create(Config::get('scheduler.schedule_status_table'), function (Blueprint $table) {
25
+        Schema::create(Config::get('scheduler.schedule_status_table'), function(Blueprint $table) {
26 26
             $table->increments('id');
27 27
             $table->string('name')->unique();
28 28
             $table->text('description')->nullable();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return void
38 38
      */
39
-    public function down()
39
+    public function down ()
40 40
     {
41 41
         Schema::drop(Config::get('scheduler.schedule_status_table'));
42 42
     }
Please login to merge, or discard this patch.
src/Scheduler/Scheduler.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @return void
34 34
      */
35
-    public function __construct($app)
35
+    public function __construct ($app)
36 36
     {
37 37
         $this->app = $app;
38 38
     }
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
      * @param string|\Carbon\Carbon $end_at
46 46
      * @return bool
47 47
      */
48
-    public function hasScheduleBetween($model_type, $start_at, $end_at)
48
+    public function hasScheduleBetween ($model_type, $start_at, $end_at)
49 49
     {
50
-        if(!Config::get('scheduler.enable_schedule_conflict'))
50
+        if (!Config::get('scheduler.enable_schedule_conflict'))
51 51
             return false;
52 52
 
53 53
         return !is_null(
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *                                         Se for nulo, ele busca a referencia da config.
70 70
      * @return array
71 71
      */
72
-    public function availableToday($model_type, $duration, $openingTime = null)
72
+    public function availableToday ($model_type, $duration, $openingTime = null)
73 73
     {
74 74
         return $this->availableOn($model_type, Carbon::now(), $duration, $openingTime);
75 75
     }
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
      *                                         Se for nulo, ele busca a referencia da config.
86 86
      * @return array
87 87
      */
88
-    public function availableOn($model_type, $today, $durationMinutes, $openingTime = null)
88
+    public function availableOn ($model_type, $today, $durationMinutes, $openingTime = null)
89 89
     {
90 90
         $openingTime = $openingTime ?? Carbon::parse(Config::get('scheduler.opening_time'))->setDateFrom($today);
91 91
         $closingTime = Carbon::parse(Config::get('scheduler.closing_time'))->setDateFrom($today);
92 92
 
93
-        $livres = [];
93
+        $livres = [ ];
94 94
         $today = Carbon::parse($today->toDateString());
95
-        while($openingTime <= $closingTime)
95
+        while ($openingTime <= $closingTime)
96 96
         {
97 97
             $add = true;
98 98
 
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
                 $start = Carbon::parse($schedule->start_at);
104 104
                 $begin = Carbon::parse($start->toDateString());
105 105
 
106
-                if($begin->greaterThan($today))
106
+                if ($begin->greaterThan($today))
107 107
                     break;
108 108
 
109
-                if($begin->notEqualTo($today))
109
+                if ($begin->notEqualTo($today))
110 110
                     continue;
111 111
 
112 112
                 $end = Carbon::parse($schedule->end_at);
113 113
 
114
-                if($this->isShouldntAdd($opening, $closing, $start, $end))
114
+                if ($this->isShouldntAdd($opening, $closing, $start, $end))
115 115
                     $add = false;
116 116
             }
117 117
 
118
-            if($add && $closing->lessThanOrEqualTo($closingTime))
119
-                $livres[] = [
118
+            if ($add && $closing->lessThanOrEqualTo($closingTime))
119
+                $livres[ ] = [
120 120
                     'start_at' => $opening,
121 121
                     'end_at' => $closing
122 122
                 ];
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @param  \Carbon\Carbon  $end
137 137
      * @return boolean
138 138
      */
139
-    private function isShouldntAdd($opening, $closing, $start, $end)
139
+    private function isShouldntAdd ($opening, $closing, $start, $end)
140 140
     {
141 141
         return $start <= $opening && $end >= $closing;
142 142
     }
@@ -154,21 +154,21 @@  discard block
 block discarded – undo
154 154
      * @throws \H4ad\Scheduler\Exceptions\EndCantBeforeStart
155 155
      * @throws \H4ad\Scheduler\Exceptions\CantAddWithSameStartAt
156 156
      */
157
-    public function validateSchedule($model_type, $start_at, $end_at = null, $status = null)
157
+    public function validateSchedule ($model_type, $start_at, $end_at = null, $status = null)
158 158
     {
159
-        if(!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
159
+        if (!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
160 160
             throw new CantAddWithoutEnd;
161 161
 
162
-        $start_at  = $this->parseToCarbon($start_at);
162
+        $start_at = $this->parseToCarbon($start_at);
163 163
 
164
-        if(!is_null($end_at)) {
164
+        if (!is_null($end_at)) {
165 165
             $end_at = $this->parseToCarbon($end_at, $start_at);
166 166
 
167
-            if($start_at->greaterThan($end_at))
167
+            if ($start_at->greaterThan($end_at))
168 168
                 throw new EndCantBeforeStart;
169 169
         }
170 170
 
171
-        if($this->hasScheduleBetween($model_type, $start_at, $end_at ?? $start_at))
171
+        if ($this->hasScheduleBetween($model_type, $start_at, $end_at ?? $start_at))
172 172
             throw new CantAddWithSameStartAt;
173 173
 
174 174
         return compact('model_type', 'start_at', 'end_at', 'status');
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @throws \H4ad\Scheduler\Exceptions\IntInvalidArgument
185 185
      */
186
-    public function parseToCarbon($date, $reference = null)
186
+    public function parseToCarbon ($date, $reference = null)
187 187
     {
188
-        if($date instanceof Carbon)
188
+        if ($date instanceof Carbon)
189 189
             return $date;
190 190
 
191
-        if(is_string($date))
191
+        if (is_string($date))
192 192
             return Carbon::parse($date);
193 193
 
194
-        if(is_int($date) && !is_null($reference))
194
+        if (is_int($date) && !is_null($reference))
195 195
             return Carbon::parse($reference->toDateTimeString())->addMinutes($date);
196 196
 
197 197
         throw new IntInvalidArgument;
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
      * @param  \Carbon\Carbon|string|int $value Valor que representará a data ou o id a ser buscado.
204 204
      * @return \H4ad\Scheduler\Models\Schedule|null
205 205
      */
206
-    public function parseToSchedule($value)
206
+    public function parseToSchedule ($value)
207 207
     {
208
-        if(is_int($value))
208
+        if (is_int($value))
209 209
             return Schedule::find($value);
210 210
 
211 211
         return Schedule::byStartAt($value)->first();
Please login to merge, or discard this patch.
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function hasScheduleBetween($model_type, $start_at, $end_at)
49 49
     {
50
-        if(!Config::get('scheduler.enable_schedule_conflict'))
51
-            return false;
50
+        if(!Config::get('scheduler.enable_schedule_conflict')) {
51
+                    return false;
52
+        }
52 53
 
53 54
         return !is_null(
54 55
             Schedule::latest()
@@ -103,23 +104,27 @@  discard block
 block discarded – undo
103 104
                 $start = Carbon::parse($schedule->start_at);
104 105
                 $begin = Carbon::parse($start->toDateString());
105 106
 
106
-                if($begin->greaterThan($today))
107
-                    break;
107
+                if($begin->greaterThan($today)) {
108
+                                    break;
109
+                }
108 110
 
109
-                if($begin->notEqualTo($today))
110
-                    continue;
111
+                if($begin->notEqualTo($today)) {
112
+                                    continue;
113
+                }
111 114
 
112 115
                 $end = Carbon::parse($schedule->end_at);
113 116
 
114
-                if($this->isShouldntAdd($opening, $closing, $start, $end))
115
-                    $add = false;
117
+                if($this->isShouldntAdd($opening, $closing, $start, $end)) {
118
+                                    $add = false;
119
+                }
116 120
             }
117 121
 
118
-            if($add && $closing->lessThanOrEqualTo($closingTime))
119
-                $livres[] = [
122
+            if($add && $closing->lessThanOrEqualTo($closingTime)) {
123
+                            $livres[] = [
120 124
                     'start_at' => $opening,
121 125
                     'end_at' => $closing
122 126
                 ];
127
+            }
123 128
 
124 129
             $openingTime->addMinutes($durationMinutes);
125 130
         }
@@ -156,20 +161,23 @@  discard block
 block discarded – undo
156 161
      */
157 162
     public function validateSchedule($model_type, $start_at, $end_at = null, $status = null)
158 163
     {
159
-        if(!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
160
-            throw new CantAddWithoutEnd;
164
+        if(!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at)) {
165
+                    throw new CantAddWithoutEnd;
166
+        }
161 167
 
162 168
         $start_at  = $this->parseToCarbon($start_at);
163 169
 
164 170
         if(!is_null($end_at)) {
165 171
             $end_at = $this->parseToCarbon($end_at, $start_at);
166 172
 
167
-            if($start_at->greaterThan($end_at))
168
-                throw new EndCantBeforeStart;
173
+            if($start_at->greaterThan($end_at)) {
174
+                            throw new EndCantBeforeStart;
175
+            }
169 176
         }
170 177
 
171
-        if($this->hasScheduleBetween($model_type, $start_at, $end_at ?? $start_at))
172
-            throw new CantAddWithSameStartAt;
178
+        if($this->hasScheduleBetween($model_type, $start_at, $end_at ?? $start_at)) {
179
+                    throw new CantAddWithSameStartAt;
180
+        }
173 181
 
174 182
         return compact('model_type', 'start_at', 'end_at', 'status');
175 183
     }
@@ -185,14 +193,17 @@  discard block
 block discarded – undo
185 193
      */
186 194
     public function parseToCarbon($date, $reference = null)
187 195
     {
188
-        if($date instanceof Carbon)
189
-            return $date;
196
+        if($date instanceof Carbon) {
197
+                    return $date;
198
+        }
190 199
 
191
-        if(is_string($date))
192
-            return Carbon::parse($date);
200
+        if(is_string($date)) {
201
+                    return Carbon::parse($date);
202
+        }
193 203
 
194
-        if(is_int($date) && !is_null($reference))
195
-            return Carbon::parse($reference->toDateTimeString())->addMinutes($date);
204
+        if(is_int($date) && !is_null($reference)) {
205
+                    return Carbon::parse($reference->toDateTimeString())->addMinutes($date);
206
+        }
196 207
 
197 208
         throw new IntInvalidArgument;
198 209
     }
@@ -205,8 +216,9 @@  discard block
 block discarded – undo
205 216
      */
206 217
     public function parseToSchedule($value)
207 218
     {
208
-        if(is_int($value))
209
-            return Schedule::find($value);
219
+        if(is_int($value)) {
220
+                    return Schedule::find($value);
221
+        }
210 222
 
211 223
         return Schedule::byStartAt($value)->first();
212 224
     }
Please login to merge, or discard this patch.
src/Scheduler/Traits/SchedulerModelTrait.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -110,16 +110,19 @@
 block discarded – undo
110 110
 	 */
111 111
 	public function removeSchedule($schedule)
112 112
 	{
113
-		if(!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
114
-			throw new CantRemoveByDate;
113
+		if(!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule)) {
114
+					throw new CantRemoveByDate;
115
+		}
115 116
 
116 117
 		$schedule = Scheduler::parseToSchedule($schedule);
117 118
 
118
-		if(!($schedule instanceof Model))
119
-			throw (new ModelNotFound)->setValues(Schedule::class);
119
+		if(!($schedule instanceof Model)) {
120
+					throw (new ModelNotFound)->setValues(Schedule::class);
121
+		}
120 122
 
121
-		if($schedule->model_type != self::class || $schedule->model_id != $this->getKey())
122
-			throw new DoesNotBelong;
123
+		if($schedule->model_type != self::class || $schedule->model_id != $this->getKey()) {
124
+					throw new DoesNotBelong;
125
+		}
123 126
 
124 127
 		return $schedule->delete();
125 128
 	}
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
      * @param  string  $localKey
32 32
      * @return \Illuminate\Database\Eloquent\Relations\HasOne
33 33
      */
34
-    abstract public function hasOne($related, $foreignKey = null, $localKey = null);
34
+    abstract public function hasOne ($related, $foreignKey = null, $localKey = null);
35 35
 
36 36
 	/**
37 37
      * Get the value of the model's primary key.
38 38
      *
39 39
      * @return mixed
40 40
      */
41
-	abstract public function getKey();
41
+	abstract public function getKey ();
42 42
 
43 43
 	/**
44 44
      * Retorna apenas o horário que possui o mesmo [model_id] do [parent] dessa [trait].
45 45
      *
46 46
      * @return \Illuminate\Database\Eloquent\Relations\HasOne
47 47
      */
48
-	public function schedules()
48
+	public function schedules ()
49 49
 	{
50 50
 		return $this->hasOne(Config::get('scheduler.schedules_table'), 'model_id');
51 51
 	}
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	 * @param  array|null $data Informações opcionais que podem ser anexadas ao horário cadastrado.
61 61
 	 * @return \H4ad\Scheduler\Models\Schedule
62 62
 	 */
63
-	public function addSchedule($start_at, $end_at = null, $status = null, $data = null)
63
+	public function addSchedule ($start_at, $end_at = null, $status = null, $data = null)
64 64
 	{
65 65
 		$schedule = Scheduler::validateSchedule(self::class, $start_at, $end_at, $status);
66 66
 
67
-		$schedule['model_id'] = $this->getKey();
68
-		$schedule['data'] = $data;
67
+		$schedule[ 'model_id' ] = $this->getKey();
68
+		$schedule[ 'data' ] = $data;
69 69
 
70 70
 		return Schedule::create($schedule);
71 71
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      *                                         Se for nulo, ele busca a referencia da config.
80 80
 	 * @return array
81 81
 	 */
82
-	public function availableToday($duration = 0, $openingTime = null)
82
+	public function availableToday ($duration = 0, $openingTime = null)
83 83
 	{
84 84
 		return Scheduler::availableToday(self::class, $duration, $openingTime);
85 85
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      *                                         Se for nulo, ele busca a referencia da config.
95 95
 	 * @return array
96 96
 	 */
97
-	public function availableOn($date, $duration = 0, $openingTime = null)
97
+	public function availableOn ($date, $duration = 0, $openingTime = null)
98 98
 	{
99 99
 		return Scheduler::availableOn(self::class, $date, $duration, $openingTime);
100 100
 	}
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
 	 * @throws \H4ad\Scheduler\Exceptions\CantRemoveByDate
112 112
 	 * @throws \H4ad\Scheduler\Exceptions\ModelNotFound
113 113
 	 */
114
-	public function removeSchedule($schedule)
114
+	public function removeSchedule ($schedule)
115 115
 	{
116
-		if(!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
116
+		if (!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
117 117
 			throw new CantRemoveByDate;
118 118
 
119 119
 		$schedule = Scheduler::parseToSchedule($schedule);
120 120
 
121
-		if(!($schedule instanceof Model))
121
+		if (!($schedule instanceof Model))
122 122
 			throw (new ModelNotFound)->setValues(Schedule::class);
123 123
 
124
-		if($schedule->model_type != self::class || $schedule->model_id != $this->getKey())
124
+		if ($schedule->model_type != self::class || $schedule->model_id != $this->getKey())
125 125
 			throw new DoesNotBelong;
126 126
 
127 127
 		return $schedule->delete();
Please login to merge, or discard this patch.