@@ -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 | } |
@@ -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 | } |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | // Session and request |
| 91 | 91 | ////////////////////////////////////////////////////////////////// |
| 92 | 92 | |
| 93 | - $app->bindIf('session.manager', function ($app) { |
|
| 93 | + $app->bindIf('session.manager', function($app) { |
|
| 94 | 94 | return new SessionManager($app); |
| 95 | 95 | }); |
| 96 | 96 | |
| 97 | - $app->bindIf('session', function ($app) { |
|
| 97 | + $app->bindIf('session', function($app) { |
|
| 98 | 98 | return $app['session.manager']->driver('array'); |
| 99 | 99 | }, true); |
| 100 | 100 | |
| 101 | - $app->bindIf('request', function ($app) { |
|
| 101 | + $app->bindIf('request', function($app) { |
|
| 102 | 102 | $request = Request::createFromGlobals(); |
| 103 | 103 | if (method_exists($request, 'setSessionStore')) { |
| 104 | 104 | $request->setSessionStore($app['session']); |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | // Config |
| 113 | 113 | ////////////////////////////////////////////////////////////////// |
| 114 | 114 | |
| 115 | - $app->bindIf('path.config', function ($app) { |
|
| 116 | - return __DIR__ . '/../config/'; |
|
| 115 | + $app->bindIf('path.config', function($app) { |
|
| 116 | + return __DIR__.'/../config/'; |
|
| 117 | 117 | }, true); |
| 118 | 118 | |
| 119 | - $app->bindIf('config', function ($app) { |
|
| 119 | + $app->bindIf('config', function($app) { |
|
| 120 | 120 | $config = new Repository; |
| 121 | 121 | $this->loadConfigurationFiles($app, $config); |
| 122 | 122 | return $config; |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | // Localization |
| 126 | 126 | ////////////////////////////////////////////////////////////////// |
| 127 | 127 | |
| 128 | - $app->bindIf('translation.loader', function ($app) { |
|
| 128 | + $app->bindIf('translation.loader', function($app) { |
|
| 129 | 129 | return new FileLoader($app['files'], 'src/config'); |
| 130 | 130 | }); |
| 131 | 131 | |
| 132 | - $app->bindIf('translator', function ($app) { |
|
| 132 | + $app->bindIf('translator', function($app) { |
|
| 133 | 133 | $loader = new FileLoader($app['files'], 'lang'); |
| 134 | 134 | |
| 135 | 135 | return new Translator($loader, 'fr'); |
@@ -181,25 +181,25 @@ discard block |
||
| 181 | 181 | public function bindFormer(Container $app) |
| 182 | 182 | { |
| 183 | 183 | // Add config namespace |
| 184 | - $configPath = __DIR__ . '/../config/former.php'; |
|
| 184 | + $configPath = __DIR__.'/../config/former.php'; |
|
| 185 | 185 | $this->mergeConfigFrom($configPath, 'former'); |
| 186 | - $this->publishes([$configPath => $app['path.config'] . '/former.php']); |
|
| 186 | + $this->publishes([$configPath => $app['path.config'].'/former.php']); |
|
| 187 | 187 | |
| 188 | 188 | $framework = $app['config']->get('former.framework'); |
| 189 | 189 | |
| 190 | - $app->bind('former.framework', function ($app) { |
|
| 190 | + $app->bind('former.framework', function($app) { |
|
| 191 | 191 | return $app['former']->getFrameworkInstance($app['config']->get('former.framework')); |
| 192 | 192 | }); |
| 193 | 193 | |
| 194 | - $app->singleton('former.populator', function ($app) { |
|
| 194 | + $app->singleton('former.populator', function($app) { |
|
| 195 | 195 | return new Populator(); |
| 196 | 196 | }); |
| 197 | 197 | |
| 198 | - $app->singleton('former.dispatcher', function ($app) { |
|
| 198 | + $app->singleton('former.dispatcher', function($app) { |
|
| 199 | 199 | return new MethodDispatcher($app, Former::FIELDSPACE); |
| 200 | 200 | }); |
| 201 | 201 | |
| 202 | - $app->singleton('former', function ($app) { |
|
| 202 | + $app->singleton('former', function($app) { |
|
| 203 | 203 | return new Former($app, $app->make('former.dispatcher')); |
| 204 | 204 | }); |
| 205 | 205 | $app->alias('former', 'Former\Former'); |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | $classes = array_intersect($classes, $this->fields); |
| 140 | 140 | |
| 141 | 141 | // Prepend field type |
| 142 | - $classes = array_map(function ($class) { |
|
| 142 | + $classes = array_map(function($class) { |
|
| 143 | 143 | return Str::startsWith($class, 'col') ? $class : 'input-'.$class; |
| 144 | 144 | }, $classes); |
| 145 | 145 | |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | $classes = array_intersect($classes, $this->fields); |
| 125 | 125 | |
| 126 | 126 | // Prepend field type |
| 127 | - $classes = array_map(function ($class) { |
|
| 127 | + $classes = array_map(function($class) { |
|
| 128 | 128 | return Str::startsWith($class, 'span') ? $class : 'input-'.$class; |
| 129 | 129 | }, $classes); |
| 130 | 130 | |