Passed
Branch master (72070c)
by Vinicius Lourenço
03:38
created
src/Scheduler/Traits/SchedulerModelTrait.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,28 +27,28 @@
 block discarded – undo
27 27
 trait SchedulerModelTrait
28 28
 {
29 29
 	/**
30
-     * Define an inverse one-to-one or many relationship.
31
-     *
32
-     * @param  string  $related
33
-     * @param  string  $foreignKey
34
-     * @param  string  $ownerKey
35
-     * @param  string  $relation
36
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
37
-     */
30
+	 * Define an inverse one-to-one or many relationship.
31
+	 *
32
+	 * @param  string  $related
33
+	 * @param  string  $foreignKey
34
+	 * @param  string  $ownerKey
35
+	 * @param  string  $relation
36
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
37
+	 */
38 38
 	abstract public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null);
39 39
 
40 40
 	/**
41
-     * Get the value of the model's primary key.
42
-     *
43
-     * @return mixed
44
-     */
41
+	 * Get the value of the model's primary key.
42
+	 *
43
+	 * @return mixed
44
+	 */
45 45
 	abstract public function getKey();
46 46
 
47 47
 	/**
48
-     * Retorna apenas os horários que possuem o mesmo [model_type] do [parent] dessa [trait].
49
-     *
50
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
51
-     */
48
+	 * Retorna apenas os horários que possuem o mesmo [model_type] do [parent] dessa [trait].
49
+	 *
50
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
51
+	 */
52 52
 	public function schedules()
53 53
 	{
54 54
 		return $this->belongsTo(Config::get('scheduler.schedules_table'), 'model_id')->where('model_type', self::class);
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -35,21 +35,21 @@  discard block
 block discarded – undo
35 35
      * @param  string  $relation
36 36
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
37 37
      */
38
-	abstract public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null);
38
+	abstract public function belongsTo ($related, $foreignKey = null, $ownerKey = null, $relation = null);
39 39
 
40 40
 	/**
41 41
      * Get the value of the model's primary key.
42 42
      *
43 43
      * @return mixed
44 44
      */
45
-	abstract public function getKey();
45
+	abstract public function getKey ();
46 46
 
47 47
 	/**
48 48
      * Retorna apenas os horários que possuem o mesmo [model_type] do [parent] dessa [trait].
49 49
      *
50 50
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
51 51
      */
52
-	public function schedules()
52
+	public function schedules ()
53 53
 	{
54 54
 		return $this->belongsTo(Config::get('scheduler.schedules_table'), 'model_id')->where('model_type', self::class);
55 55
 	}
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
 	 * @throws \H4ad\Scheduler\Exceptions\CantAddWithSameStartAt
68 68
 	 * @throws \H4ad\Scheduler\Exceptions\EndCantBeforeStart
69 69
 	 */
70
-	public function addSchedule($start_at, $end_at = null, $status = null)
70
+	public function addSchedule ($start_at, $end_at = null, $status = null)
71 71
 	{
72
-		if(!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
72
+		if (!Config::get('scheduler.enable_schedule_without_end') && is_null($end_at))
73 73
 			throw new CantAddWithoutEnd;
74 74
 
75
-		if(is_string($start_at))
75
+		if (is_string($start_at))
76 76
 			$start_at = Carbon::parse($start_at);
77 77
 
78
-		if(is_string($end_at))
78
+		if (is_string($end_at))
79 79
 			$end_at = Carbon::parse($end_at);
80 80
 
81
-		if(is_int($end_at))
81
+		if (is_int($end_at))
82 82
 			$end_at = Carbon::parse($start_at->toDateTimeString())->addMinutes($end_at);
83 83
 
84
-		if(Config::get('scheduler.enable_schedule_conflict'))
85
-			if(Scheduler::hasScheduleBetween($start_at, $end_at ?? $start_at))
84
+		if (Config::get('scheduler.enable_schedule_conflict'))
85
+			if (Scheduler::hasScheduleBetween($start_at, $end_at ?? $start_at))
86 86
 				throw new CantAddWithSameStartAt;
87 87
 
88
-		if($start_at->greaterThan($end_at) && !is_null($end_at))
88
+		if ($start_at->greaterThan($end_at) && !is_null($end_at))
89 89
 			throw new EndCantBeforeStart;
90 90
 
91 91
 		$model_id = $this->getKey();
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 	 * @throws \H4ad\Scheduler\Exceptions\CantRemoveByDate
107 107
 	 * @throws \H4ad\Scheduler\Exceptions\ModelNotFound
108 108
 	 */
109
-	public function removeSchedule($schedule)
109
+	public function removeSchedule ($schedule)
110 110
 	{
111
-		if(!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
111
+		if (!Config::get('scheduler.enable_schedule_conflict') && !is_int($schedule))
112 112
 			throw new CantRemoveByDate;
113 113
 
114
-		if(is_int($schedule))
114
+		if (is_int($schedule))
115 115
 			$schedule = Schedule::find($schedule);
116 116
 
117
-		if(is_string($schedule) || $schedule instanceof Carbon)
117
+		if (is_string($schedule) || $schedule instanceof Carbon)
118 118
 			$schedule = Schedule::byStartAt($schedule)->first();
119 119
 
120
-		if(!($schedule instanceof Model))
120
+		if (!($schedule instanceof Model))
121 121
 			throw (new ModelNotFound)->setValues(Schedule::class);
122 122
 
123
-		if($schedule->model_type != self::class)
123
+		if ($schedule->model_type != self::class)
124 124
 			throw new DoesNotBelong;
125 125
 
126 126
 		return $schedule->delete();
Please login to merge, or discard this patch.
src/Scheduler/Contracts/SchedulerModelTrait.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
 interface SchedulerModelInterface
12 12
 {
13 13
 	/**
14
-     * Define an inverse one-to-one or many relationship.
15
-     *
16
-     * @param  string  $related
17
-     * @param  string  $foreignKey
18
-     * @param  string  $ownerKey
19
-     * @param  string  $relation
20
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
21
-     */
14
+	 * Define an inverse one-to-one or many relationship.
15
+	 *
16
+	 * @param  string  $related
17
+	 * @param  string  $foreignKey
18
+	 * @param  string  $ownerKey
19
+	 * @param  string  $relation
20
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
21
+	 */
22 22
 	abstract public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null);
23 23
 
24 24
 	/**
25
-     * Get the value of the model's primary key.
26
-     *
27
-     * @return mixed
28
-     */
25
+	 * Get the value of the model's primary key.
26
+	 *
27
+	 * @return mixed
28
+	 */
29 29
 	abstract public function getKey();
30 30
 
31 31
 	/**
32
-     * Retorna apenas os horários que possuem o mesmo [model_type] do [parent] dessa [trait].
33
-     *
34
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
35
-     */
32
+	 * Retorna apenas os horários que possuem o mesmo [model_type] do [parent] dessa [trait].
33
+	 *
34
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
35
+	 */
36 36
 	public function schedules();
37 37
 
38 38
 	/**
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
      * @param  string  $relation
20 20
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
21 21
      */
22
-	abstract public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null);
22
+	abstract public function belongsTo ($related, $foreignKey = null, $ownerKey = null, $relation = null);
23 23
 
24 24
 	/**
25 25
      * Get the value of the model's primary key.
26 26
      *
27 27
      * @return mixed
28 28
      */
29
-	abstract public function getKey();
29
+	abstract public function getKey ();
30 30
 
31 31
 	/**
32 32
      * Retorna apenas os horários que possuem o mesmo [model_type] do [parent] dessa [trait].
33 33
      *
34 34
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
35 35
      */
36
-	public function schedules();
36
+	public function schedules ();
37 37
 
38 38
 	/**
39 39
 	 * Agenda um horário para esta model.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @throws \H4ad\Scheduler\Exceptions\CantAddWithSameStartAt
49 49
 	 * @throws \H4ad\Scheduler\Exceptions\EndCantBeforeStart
50 50
 	 */
51
-	public function addSchedule($start_at, $end_at = null, $status = null);
51
+	public function addSchedule ($start_at, $end_at = null, $status = null);
52 52
 
53 53
 	/**
54 54
 	 * Exibe uma lista dos horários do dia de hoje.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 *                          que precisem ter uma certa duração.
58 58
 	 * @return array
59 59
 	 */
60
-	public function availableToday($duration = 0);
60
+	public function availableToday ($duration = 0);
61 61
 
62 62
 	/**
63 63
 	 * Lista os horários livres em um determinado dia.
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 *                          que precisem ter uma certa duração.
68 68
 	 * @return array
69 69
 	 */
70
-	public function availableOn($date, $duration = 0);
70
+	public function availableOn ($date, $duration = 0);
71 71
 
72 72
 	/**
73 73
 	 * Remove um horário agendado pelo seu ID ou pelo horário em que foi marcado.
@@ -81,5 +81,5 @@  discard block
 block discarded – undo
81 81
 	 * @throws \H4ad\Scheduler\Exceptions\CantRemoveByDate
82 82
 	 * @throws \H4ad\Scheduler\Exceptions\ModelNotFound
83 83
 	 */
84
-	public function removeSchedule($schedule);
84
+	public function removeSchedule ($schedule);
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.