Passed
Branch master (3ea7c5)
by Vinicius Lourenço
06:59
created
src/Scheduler/SchedulerServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      */
39 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
 
Please login to merge, or discard this patch.
src/Scheduler/Scheduler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
         $openingTime = Carbon::parse(Config::get('scheduler.opening_time'))->setDateFrom($today);
78 78
         $closingTime = Carbon::parse(Config::get('scheduler.closing_time'))->setDateFrom($today);
79 79
 
80
-        $livres = [];
80
+        $livres = [ ];
81 81
         $today = Carbon::parse($today->toDateString());
82
-        while($openingTime <= $closingTime)
82
+        while ($openingTime <= $closingTime)
83 83
         {
84 84
             $add = true;
85 85
 
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
                 $start = Carbon::parse($schedule->start_at);
88 88
                 $begin = Carbon::parse($start->toDateString());
89 89
 
90
-                if($begin->greaterThan($today))
90
+                if ($begin->greaterThan($today))
91 91
                     break;
92 92
 
93
-                if($begin->notEqualTo($today))
93
+                if ($begin->notEqualTo($today))
94 94
                     continue;
95 95
 
96 96
                 $end = Carbon::parse($schedule->end_at);
97
-                if($start <= Carbon::parse($openingTime->toDateTimeString())
97
+                if ($start <= Carbon::parse($openingTime->toDateTimeString())
98 98
                 && $end >= Carbon::parse($openingTime->toDateTimeString())->addMinutes($durationMinutes))
99 99
                     $add = false;
100 100
             }
101 101
 
102
-            if($add)
103
-                $livres[] = [
102
+            if ($add)
103
+                $livres[ ] = [
104 104
                     'start_at' => Carbon::parse($openingTime->toDateTimeString()),
105 105
                     'end_at' => Carbon::parse($openingTime->toDateTimeString())->addMinutes($durationMinutes)
106 106
                 ];
Please login to merge, or discard this patch.
Scheduler/Migrations/2018_08_12_000000_create_schedule_status_table.php.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      */
23 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();
Please login to merge, or discard this patch.
src/Scheduler/Migrations/2018_08_12_000000_create_schedules_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      */
23 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');
Please login to merge, or discard this patch.
src/Scheduler/Exceptions/CustomException.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function render()
78 78
     {
79 79
         return response()->json([
80
-            'messages' => trans('scheduler::exceptions.'. $this->trans, $this->parseValues())
80
+            'messages' => trans('scheduler::exceptions.'.$this->trans, $this->parseValues())
81 81
         ], $this->statusCode);
82 82
     }
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function parseValues()
90 90
     {
91
-        if(is_array($this->attributes) && is_array($this->values))
91
+        if (is_array($this->attributes) && is_array($this->values))
92 92
             return collect($this->attributes)->combine($this->values)->all();
93 93
 
94 94
         return [ $this->attributes => $this->values ?? $this->isLower() ];
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      */
112 112
     protected function getAlias()
113 113
     {
114
-        if(is_object($this->model))
114
+        if (is_object($this->model))
115 115
             $this->model = get_class($this->model);
116 116
 
117
-        return collect(trans('scheduler::exceptions.aliases.'. $this->aliastype))->search($this->model) ?: 'Recurso';
117
+        return collect(trans('scheduler::exceptions.aliases.'.$this->aliastype))->search($this->model) ?: 'Recurso';
118 118
     }
119 119
 
120 120
     /**
Please login to merge, or discard this patch.
src/Scheduler/Models/Schedule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@
 block discarded – undo
51 51
      */
52 52
     public function parseStatusKey($key)
53 53
     {
54
-    	if(is_int($key))
55
-    		return ['status' => $key];
54
+    	if (is_int($key))
55
+    		return [ 'status' => $key ];
56 56
 
57 57
     	$status = ScheduleStatus::where('name', $name)->first();
58 58
 
59
-    	if(is_null($status))
59
+    	if (is_null($status))
60 60
     		throw (new ModelNotFoundException)->setModel(ScheduleStatus::class, $name);
61 61
 
62
-    	return ['status' => $status->id];
62
+    	return [ 'status' => $status->id ];
63 63
     }
64 64
 
65 65
     /**
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/Traits/SchedulerModelTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function addSchedule($start_at, $end_at = null, $status = null)
53 53
 	{
54
-		if(!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
54
+		if (!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
55 55
 			throw new CantAddWithoutEnd;
56 56
 
57
-		if(is_string($start_at))
57
+		if (is_string($start_at))
58 58
 			$start_at = Carbon::parse($start_at);
59 59
 
60
-		if(is_string($end_at))
60
+		if (is_string($end_at))
61 61
 			$end_at = Carbon::parse($end_at);
62 62
 
63
-		if(is_int($end_at))
63
+		if (is_int($end_at))
64 64
 			$end_at = Carbon::parse($start_at->toDateTimeString())->addMinutes($end_at);
65 65
 
66
-		if(Config::get('scheduler.enable_schedule_conflict'))
67
-			if(Scheduler::hasScheduleBetween($start_at, $end_at ?? $start_at))
66
+		if (Config::get('scheduler.enable_schedule_conflict'))
67
+			if (Scheduler::hasScheduleBetween($start_at, $end_at ?? $start_at))
68 68
 				throw new CantAddWithSameStartAt;
69 69
 
70
-		if($start_at->greaterThan($end_at) && !is_null($end_at))
70
+		if ($start_at->greaterThan($end_at) && !is_null($end_at))
71 71
 			throw new EndCantBeforeStart;
72 72
 
73 73
 		$model_id = $this->getKey();
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function removeSchedule($schedule)
92 92
 	{
93
-		if(!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
93
+		if (!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
94 94
 			throw new CantRemoveByDate;
95 95
 
96
-		if(is_int($schedule))
96
+		if (is_int($schedule))
97 97
 			$schedule = Schedule::find($schedule);
98 98
 
99
-		if(is_string($schedule) || $schedule instanceof Carbon)
99
+		if (is_string($schedule) || $schedule instanceof Carbon)
100 100
 			$schedule = Schedule::byStartAt($schedule)->first();
101 101
 
102
-		if(!($schedule instanceof Model))
102
+		if (!($schedule instanceof Model))
103 103
 			throw (new ModelNotFound)->setValues(Schedule::class);
104 104
 
105
-		if($schedule->model_type != self::class)
105
+		if ($schedule->model_type != self::class)
106 106
 			throw new DoesNotBelong;
107 107
 
108 108
 		return $schedule->delete();
Please login to merge, or discard this patch.