@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function register(Fol $app) |
| 13 | 13 | { |
| 14 | - $app['builder'] = function ($app) { |
|
| 14 | + $app['builder'] = function($app) { |
|
| 15 | 15 | $builder = new FormBuilder(); |
| 16 | 16 | $builder->add(new FormatFactory($builder)); |
| 17 | 17 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function register(Fol $app) |
| 12 | 12 | { |
| 13 | - $app['router'] = function ($app) { |
|
| 13 | + $app['router'] = function($app) { |
|
| 14 | 14 | $router = new RouterContainer(); |
| 15 | 15 | |
| 16 | 16 | $map = $router->getMap(); |
@@ -29,6 +29,6 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | protected function parse($source) |
| 31 | 31 | { |
| 32 | - return (array) SymfonyYaml::parse($source); |
|
| 32 | + return (array)SymfonyYaml::parse($source); |
|
| 33 | 33 | } |
| 34 | 34 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $sort = $search->getSort(); |
| 53 | 53 | |
| 54 | 54 | if ($sort) { |
| 55 | - uasort($result, function ($a, $b) use ($sort) { |
|
| 55 | + uasort($result, function($a, $b) use ($sort) { |
|
| 56 | 56 | if ($a[$sort] === $b[$sort]) { |
| 57 | 57 | return 0; |
| 58 | 58 | } |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | * |
| 127 | 127 | * @param array $data |
| 128 | 128 | * |
| 129 | - * @return string |
|
| 129 | + * @return integer |
|
| 130 | 130 | */ |
| 131 | 131 | protected function getId(array $data) |
| 132 | 132 | { |
@@ -39,6 +39,9 @@ |
||
| 39 | 39 | return $dispatcher($request, new Response()); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | + /** |
|
| 43 | + * @param string $name |
|
| 44 | + */ |
|
| 42 | 45 | public function getRoute($name, array $data = array(), array $query = null) |
| 43 | 46 | { |
| 44 | 47 | return $this->getUrl($this['router']->getGenerator()->generate($name, $data)).($query ? '?'.http_build_query($query) : ''); |
@@ -27,18 +27,18 @@ |
||
| 27 | 27 | |
| 28 | 28 | if (!empty($_POST)) |
| 29 | 29 | { |
| 30 | - foreach ( $_POST as $key => $value ) |
|
| 30 | + foreach ($_POST as $key => $value) |
|
| 31 | 31 | { |
| 32 | - if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) |
|
| 32 | + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) |
|
| 33 | 33 | continue; |
| 34 | 34 | |
| 35 | - if ( get_magic_quotes_gpc() ) |
|
| 36 | - $value = htmlspecialchars( stripslashes((string)$value) ); |
|
| 35 | + if (get_magic_quotes_gpc()) |
|
| 36 | + $value = htmlspecialchars(stripslashes((string)$value)); |
|
| 37 | 37 | else |
| 38 | - $value = htmlspecialchars( (string)$value ); |
|
| 38 | + $value = htmlspecialchars((string)$value); |
|
| 39 | 39 | ?> |
| 40 | 40 | <tr> |
| 41 | - <th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th> |
|
| 41 | + <th style="vertical-align: top"><?php echo htmlspecialchars((string)$key); ?></th> |
|
| 42 | 42 | <td><pre class="samples"><?php echo $value; ?></pre></td> |
| 43 | 43 | </tr> |
| 44 | 44 | <?php |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public function register(Fol $app) |
| 14 | 14 | { |
| 15 | - $app['templates'] = function ($app) { |
|
| 15 | + $app['templates'] = function($app) { |
|
| 16 | 16 | $root = dirname(dirname(__DIR__)); |
| 17 | 17 | |
| 18 | 18 | $templates = new Engine($root.'/templates'); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $templates->addData(['app' => $app]); |
| 22 | 22 | |
| 23 | - $templates->registerFunction('icon', function ($name) use ($icons) { |
|
| 23 | + $templates->registerFunction('icon', function($name) use ($icons) { |
|
| 24 | 24 | return $icons->get($name); |
| 25 | 25 | }); |
| 26 | 26 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function setPage($page) |
| 119 | 119 | { |
| 120 | - $this->page = (int) $page; |
|
| 120 | + $this->page = (int)$page; |
|
| 121 | 121 | |
| 122 | 122 | return $this; |
| 123 | 123 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function setLimit($limit) |
| 143 | 143 | { |
| 144 | - $this->limit = (int) $limit; |
|
| 144 | + $this->limit = (int)$limit; |
|
| 145 | 145 | |
| 146 | 146 | return $this; |
| 147 | 147 | } |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public function register(Fol $app) |
| 14 | 14 | { |
| 15 | - $app['middlewares'] = function ($app) { |
|
| 15 | + $app['middlewares'] = function($app) { |
|
| 16 | 16 | return [ |
| 17 | - Middleware::create(function () use ($app) { |
|
| 17 | + Middleware::create(function() use ($app) { |
|
| 18 | 18 | if ($app->has('users')) { |
| 19 | 19 | return Middleware::DigestAuthentication($app['users']); |
| 20 | 20 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | Middleware::errorHandler('Folk\\Controllers\\Error') |
| 28 | 28 | ->catchExceptions() |
| 29 | - ->statusCode(function ($code) { |
|
| 29 | + ->statusCode(function($code) { |
|
| 30 | 30 | return $code > 400 && $code < 600; |
| 31 | 31 | }) |
| 32 | 32 | ->arguments($app), |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | Middleware::languageNegotiator(['en', 'gl', 'es']), |
| 41 | 41 | |
| 42 | - function ($request, $response, $next) { |
|
| 42 | + function($request, $response, $next) { |
|
| 43 | 43 | $language = Middleware\LanguageNegotiator::getLanguage($request); |
| 44 | 44 | $translator = new Translator(); |
| 45 | 45 | $translator->loadTranslations(Translations::fromPoFile(dirname(dirname(__DIR__)).'/locales/'.$language.'.po')); |