Skip to content

Commit 9afd698

Browse files
authored
Merge pull request #303 from dbarzin/dev
code quality
2 parents e42a338 + f2253e6 commit 9afd698

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

app/Calendar.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ public function __toString()
9292
foreach ($this->events as $event) {
9393
for ($d = 0; $d <= $event[2] - 1; $d++) {
9494
if (date('y-m-d', strtotime($this->active_year . '-' . $this->active_month . '-' . $i . ' -' . $d . ' day')) === date('y-m-d', strtotime($event[1]))) {
95-
if ($event[4]!==null)
95+
if ($event[4] !== null) {
9696
$html .= '<a href="/bob/show/' . $event[4] . '">';
97+
}
9798
$html .= '<div class="event' . $event[3] . '">';
9899
$html .= $event[0];
99100
$html .= '</div>';
100-
if ($event[4]!==null)
101+
if ($event[4] !== null) {
101102
$html .= '</a>';
103+
}
102104
}
103105
}
104106
}

app/Http/Controllers/ControlController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,8 @@ public function history()
722722
'controls.realisation_date',
723723
'controls.plan_date',
724724
'controls.periodicity',
725-
'measures.clause')
725+
'measures.clause'
726+
)
726727
->leftJoin('control_measure', 'controls.id', '=', 'control_measure.control_id')
727728
->join('measures', 'control_measure.measure_id', '=', 'measures.id')
728729
->get();
@@ -739,8 +740,8 @@ public function history()
739740
foreach ($controls as $control) {
740741
$expandedControls->push($control);
741742

742-
if (($control->realisation_date==null)&&
743-
($control->periodicity>0)&&($control->periodicity<=12))
743+
if (($control->realisation_date === null) &&
744+
($control->periodicity > 0) && ($control->periodicity <= 12)) {
744745
for ($i = 1; $i <= 12 / $control->periodicity; $i++) {
745746
$repeatedControl = clone $control;
746747
$repeatedControl->id = null;
@@ -750,6 +751,7 @@ public function history()
750751
$repeatedControl->plan_date = Carbon::parse($control->plan_date)->addMonthsNoOverflow($i * $control->periodicity);
751752
$expandedControls->push($repeatedControl);
752753
}
754+
}
753755
}
754756
// Return view with controls
755757
return view('controls.history')

app/Http/Controllers/HomeController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,5 +205,4 @@ private function getExpandedControls()
205205
return $expanded;
206206
});
207207
}
208-
209208
}

app/Http/Controllers/MeasureController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ public function show(int $id)
197197

198198
// Get associate controls
199199
$controls = DB::table('controls')
200-
->select('controls.id','controls.name','controls.scope','score','controls.status','realisation_date','plan_date')
201-
->join('control_measure', 'control_measure.control_id', '=', 'controls.id')
202-
->leftjoin('actions', 'actions.control_id', '=', 'controls.id')
203-
->where('control_measure.measure_id', $id)
204-
->get();
200+
->select('controls.id', 'controls.name', 'controls.scope', 'score', 'controls.status', 'realisation_date', 'plan_date')
201+
->join('control_measure', 'control_measure.control_id', '=', 'controls.id')
202+
->leftjoin('actions', 'actions.control_id', '=', 'controls.id')
203+
->where('control_measure.measure_id', $id)
204+
->get();
205205

206206
return view('measures.show')
207207
->with('measure', $measure)

0 commit comments

Comments
 (0)