Skip to content

Commit

Permalink
Applied fixes from StyleCI (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grasseh committed Jul 28, 2016
1 parent 59a8148 commit 1228247
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
19 changes: 12 additions & 7 deletions src/anekdotes/Controls/RangeSelect.php
Expand Up @@ -33,23 +33,28 @@ public function prepare($arguments)
$opts = $arguments[1];
$default = $arguments[2];

$start = Arr::get($opts, 'start', 1);
$end = Arr::get($opts, 'end', 10);
$step = Arr::get($opts, 'step', 1);
$inverted = Arr::get($opts, 'inverted', false);
$start = Arr::get($opts, 'start', 1);
$end = Arr::get($opts, 'end', 10);
$step = Arr::get($opts, 'step', 1);
$inverted = Arr::get($opts, 'inverted', false);
Arr::remove('start', $opts);
Arr::remove('end', $opts);
Arr::remove('step', $opts);
Arr::remove('inverted', $opts);
$opts['value'] = 0;
$opts['key'] = 0;
$values = array();
$values = [];
if ($inverted) {
for ($i=$end; $i >= $start; $i -= $step) { $values[] = array($i); }
for ($i = $end; $i >= $start; $i -= $step) {
$values[] = [$i];
}
} else {
for ($i=$start; $i <= $end; $i += $step) { $values[] = array($i); }
for ($i = $start; $i <= $end; $i += $step) {
$values[] = [$i];
}
}
$select = new Select();

return $select->prepare([$name, $values, $opts, [$default], '']);
}
}
16 changes: 8 additions & 8 deletions tests/controls/RangeSelectControlTest.php
Expand Up @@ -22,10 +22,10 @@ public function testRangeSelectPrepare()
$opts = [
'name',
[
'class' => 'form',
'step' => 1,
'start' => 1,
'end' => 10,
'class' => 'form',
'step' => 1,
'start' => 1,
'end' => 10,
'inverted' => false,
],
5,
Expand All @@ -40,10 +40,10 @@ public function testRangeSelectPrepareInverted()
$opts = [
'name',
[
'class' => 'form',
'step' => 1,
'start' => 1,
'end' => 10,
'class' => 'form',
'step' => 1,
'start' => 1,
'end' => 10,
'inverted' => true,
],
5,
Expand Down

0 comments on commit 1228247

Please sign in to comment.