Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
uyab committed Aug 11, 2016
1 parent 772ee10 commit 9a0b1fb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/SemanticForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function text($name, $defaultValue = null)

$text->defaultValue($defaultValue);

if($this->hasError($name)) {
if ($this->hasError($name)) {
$text->setError();
}

Expand All @@ -94,7 +94,7 @@ public function date($name, $defaultValue = null)

$date->defaultValue($defaultValue);

if($this->hasError($name)) {
if ($this->hasError($name)) {
$date->setError();
}

Expand All @@ -111,7 +111,7 @@ public function email($name, $defaultValue = null)

$email->defaultValue($defaultValue);

if($this->hasError($name)) {
if ($this->hasError($name)) {
$email->setError();
}

Expand Down Expand Up @@ -140,7 +140,7 @@ public function textarea($name, $defaultValue = null)

$textarea->defaultValue($defaultValue);

if($this->hasError($name)) {
if ($this->hasError($name)) {
$textarea->setError();
}

Expand All @@ -151,7 +151,7 @@ public function password($name)
{
$password = new Password($name);

if($this->hasError($name)) {
if ($this->hasError($name)) {
$password->setError();
}

Expand All @@ -177,10 +177,10 @@ public function checkboxGroup($name, $options, $checked = [])
$controls = [];
$oldValue = $this->getValueFor($name);

foreach($options as $value => $label) {
$radio = (new Checkbox($name . "[$value]", $value))->label($label);
foreach ($options as $value => $label) {
$radio = (new Checkbox($name."[$value]", $value))->label($label);

if($oldValue !== null) {
if ($oldValue !== null) {
if (in_array($value, $oldValue)) {
$radio->check();
}
Expand Down Expand Up @@ -216,7 +216,7 @@ public function radioGroup($name, $options, $checked = null)
$controls = [];
$oldValue = $this->getValueFor($name);

foreach($options as $value => $label) {
foreach ($options as $value => $label) {
$radio = (new RadioButton($name, $value))->label($label);

if (($oldValue !== null && $value == $oldValue) || ($oldValue === null && $value == $checked)) {
Expand Down Expand Up @@ -385,9 +385,9 @@ public function selectDate($name, $beginYear = 1900, $endYear = null)
$endYear = date('Y') + 10;
}

$date = (new Field($this->selectRange('_'.$name . '[date]', 1, 31)->addClass('compact')));
$month = (new Field($this->selectMonth('_'.$name . '[month]')->addClass('compact')));
$year = (new Field($this->selectRange('_'.$name . '[year]', $beginYear, $endYear)->addClass('compact')));
$date = (new Field($this->selectRange('_'.$name.'[date]', 1, 31)->addClass('compact')));
$month = (new Field($this->selectMonth('_'.$name.'[month]')->addClass('compact')));
$year = (new Field($this->selectRange('_'.$name.'[year]', $beginYear, $endYear)->addClass('compact')));

return new SelectDateWrapper($date, $month, $year);
}
Expand All @@ -398,13 +398,13 @@ public function selectDateTime($name, $beginYear = 1900, $endYear = null, $inter
$endYear = date('Y') + 10;
}

$date = (new Field($this->selectRange('_'.$name . '[date]', 1, 31)->addClass('compact')));
$month = (new Field($this->selectMonth('_'.$name . '[month]')->addClass('compact')));
$year = (new Field($this->selectRange('_'.$name . '[year]', $beginYear, $endYear)->addClass('compact')));
$date = (new Field($this->selectRange('_'.$name.'[date]', 1, 31)->addClass('compact')));
$month = (new Field($this->selectMonth('_'.$name.'[month]')->addClass('compact')));
$year = (new Field($this->selectRange('_'.$name.'[year]', $beginYear, $endYear)->addClass('compact')));

$timeOptions = $this->getTimeOptions($interval);

$time = (new Field($this->select('_'.$name . '[time]', $timeOptions)->addClass('compact')));
$time = (new Field($this->select('_'.$name.'[time]', $timeOptions)->addClass('compact')));

return new SelectDateTimeWrapper($date, $month, $year, $time);
}
Expand All @@ -416,7 +416,7 @@ protected function getTimeOptions($interval)
$tomorrow = clone $today;
$tomorrow->addDay(1);

while($today < $tomorrow) {
while ($today < $tomorrow) {
$key = $val = sprintf('%s:%s', $today->format('H'), $today->format('i'));
$times[$key] = $val;

Expand Down

0 comments on commit 9a0b1fb

Please sign in to comment.