@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php namespace Former\Exceptions; |
| 2 | 2 | |
| 3 | -class InvalidFrameworkException extends \RuntimeException{ |
|
| 3 | +class InvalidFrameworkException extends \RuntimeException { |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * reference to framework class |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | //Convert parametrs of old format to new format |
| 128 | 128 | if (!is_callable($text)) { |
| 129 | 129 | $optionTextValue = $text; |
| 130 | - $text = function ($model) use($optionTextValue) { |
|
| 130 | + $text = function($model) use($optionTextValue) { |
|
| 131 | 131 | if ($optionTextValue and isset($model->$optionTextValue)) { |
| 132 | 132 | return $model->$optionTextValue; |
| 133 | 133 | } elseif (method_exists($model, '__toString')) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $optionAttributeValue = $modelAttributeName($model); |
| 173 | 173 | } elseif ($modelAttributeName and isset($model->$modelAttributeName)) { |
| 174 | 174 | $optionAttributeValue = $model->$modelAttributeName; |
| 175 | - } elseif($optionAttributeName === 'value') { |
|
| 175 | + } elseif ($optionAttributeName === 'value') { |
|
| 176 | 176 | //For backward compatibility |
| 177 | 177 | if (method_exists($model, 'getKey')) { |
| 178 | 178 | $optionAttributeValue = $model->getKey(); |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | public function getContent() |
| 53 | 53 | { |
| 54 | - $content = array_map(function ($content) { |
|
| 54 | + $content = array_map(function($content) { |
|
| 55 | 55 | return method_exists($content, '__toString') ? (string) $content : $content; |
| 56 | 56 | }, $this->value); |
| 57 | 57 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->name .= '[]'; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if ( ! $this->value instanceOf \ArrayAccess) { |
|
| 93 | + if (!$this->value instanceOf \ArrayAccess) { |
|
| 94 | 94 | $this->value = (array) $this->value; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | foreach ($parent->getChildren() as $child) { |
| 133 | 133 | // Search by value |
| 134 | 134 | |
| 135 | - if ($child->getAttribute('value') === $value || is_numeric($value) && $child->getAttribute('value') === (int)$value ) { |
|
| 135 | + if ($child->getAttribute('value') === $value || is_numeric($value) && $child->getAttribute('value') === (int) $value) { |
|
| 136 | 136 | $child->selected('selected'); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->url = $url; |
| 97 | 97 | $this->populator = $populator; |
| 98 | 98 | |
| 99 | - $this->app->singleton('former.form.framework', function ($app) { |
|
| 99 | + $this->app->singleton('former.form.framework', function($app) { |
|
| 100 | 100 | return clone $app['former.framework']; |
| 101 | 101 | }); |
| 102 | 102 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | // If raw form |
| 404 | 404 | if ($type == 'raw') { |
| 405 | - $this->app->bind('former.form.framework', function ($app) { |
|
| 405 | + $this->app->bind('former.form.framework', function($app) { |
|
| 406 | 406 | return $app['former']->getFrameworkInstance('Nude'); |
| 407 | 407 | }); |
| 408 | 408 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $this->setOption('framework', $framework); |
| 354 | 354 | |
| 355 | 355 | $framework = $this->getFrameworkInstance($framework); |
| 356 | - $this->app->bind('former.framework', function ($app) use ($framework) { |
|
| 356 | + $this->app->bind('former.framework', function($app) use ($framework) { |
|
| 357 | 357 | return $framework; |
| 358 | 358 | }); |
| 359 | 359 | } |
@@ -373,9 +373,9 @@ discard block |
||
| 373 | 373 | //get interfaces of the given framework |
| 374 | 374 | $interfaces = class_exists($framework) ? class_implements($framework) : array(); |
| 375 | 375 | |
| 376 | - if(class_exists($formerClass)) { |
|
| 376 | + if (class_exists($formerClass)) { |
|
| 377 | 377 | $returnClass = $formerClass; |
| 378 | - } elseif(class_exists($framework) && isset($interfaces['Former\Interfaces\FrameworkInterface'])) { |
|
| 378 | + } elseif (class_exists($framework) && isset($interfaces['Former\Interfaces\FrameworkInterface'])) { |
|
| 379 | 379 | // We have some outside class, lets return it. |
| 380 | 380 | $returnClass = $framework; |
| 381 | 381 | } else { |
@@ -239,7 +239,7 @@ |
||
| 239 | 239 | */ |
| 240 | 240 | protected function prependWith($classes, $with) |
| 241 | 241 | { |
| 242 | - return array_map(function ($class) use ($with) { |
|
| 242 | + return array_map(function($class) use ($with) { |
|
| 243 | 243 | return $with.$class; |
| 244 | 244 | }, $classes); |
| 245 | 245 | } |
@@ -411,7 +411,7 @@ |
||
| 411 | 411 | $this->app['former']->labels[] = $name; |
| 412 | 412 | |
| 413 | 413 | // Count number of fields with the same ID |
| 414 | - $where = array_filter($this->app['former']->labels, function ($label) use ($name) { |
|
| 414 | + $where = array_filter($this->app['former']->labels, function($label) use ($name) { |
|
| 415 | 415 | return $label == $name; |
| 416 | 416 | }); |
| 417 | 417 | $unique = sizeof($where); |
@@ -275,7 +275,7 @@ |
||
| 275 | 275 | |
| 276 | 276 | // If we have a rule with a value |
| 277 | 277 | if (($colon = strpos($rule, ':')) !== false) { |
| 278 | - $rulename = substr($rule, 0, $colon) ; |
|
| 278 | + $rulename = substr($rule, 0, $colon); |
|
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | 281 | * Regular expressions may contain commas and should not be divided by str_getcsv. |