Permalink
Browse files

Array short syntax

  • Loading branch information...
andrzejo committed Mar 29, 2017
1 parent 958f710 commit a7e80bc7aa0e97ab9eab9b9b7d6231ef0a9c7754
Showing with 1,997 additions and 1,997 deletions.
  1. +7 −7 bin/RoutesCommand.php
  2. +2 −2 console
  3. +8 −8 locales/en.php
  4. +4 −4 locales/pl.php
  5. +1 −1 src/Ouzo/Core/AutoloadNamespaces.php
  6. +6 −6 src/Ouzo/Core/Config/ConfigRepository.php
  7. +7 −7 src/Ouzo/Core/Controller.php
  8. +1 −1 src/Ouzo/Core/ControllerUrl.php
  9. +3 −3 src/Ouzo/Core/Csrf/CsrfProtector.php
  10. +6 −6 src/Ouzo/Core/Db.php
  11. +2 −2 src/Ouzo/Core/Db/BatchInserter.php
  12. +3 −3 src/Ouzo/Core/Db/BatchLoadingSession.php
  13. +1 −1 src/Ouzo/Core/Db/Dialect/DialectUtil.php
  14. +1 −1 src/Ouzo/Core/Db/Dialect/MySqlDialect.php
  15. +1 −1 src/Ouzo/Core/Db/Dialect/PostgresDialect.php
  16. +1 −1 src/Ouzo/Core/Db/Dialect/Sqlite3Dialect.php
  17. +2 −2 src/Ouzo/Core/Db/EmptyQueryExecutor.php
  18. +8 −8 src/Ouzo/Core/Db/ModelDefinition.php
  19. +1 −1 src/Ouzo/Core/Db/ModelJoin.php
  20. +11 −11 src/Ouzo/Core/Db/ModelQueryBuilder.php
  21. +3 −3 src/Ouzo/Core/Db/ModelQueryBuilderHelper.php
  22. +3 −3 src/Ouzo/Core/Db/ModelResultSetConverter.php
  23. +1 −1 src/Ouzo/Core/Db/PDOPreparedStatementExecutor.php
  24. +1 −1 src/Ouzo/Core/Db/PreparedStatementEmulator.php
  25. +7 −7 src/Ouzo/Core/Db/Query.php
  26. +1 −1 src/Ouzo/Core/Db/QueryBoundValuesExtractor.php
  27. +1 −1 src/Ouzo/Core/Db/QueryExecutor.php
  28. +1 −1 src/Ouzo/Core/Db/RelationFactory.php
  29. +3 −3 src/Ouzo/Core/Db/RelationFetcher.php
  30. +1 −1 src/Ouzo/Core/Db/StatementExecutor.php
  31. +3 −3 src/Ouzo/Core/Db/Stats.php
  32. +1 −1 src/Ouzo/Core/Db/TransactionalProxy.php
  33. +1 −1 src/Ouzo/Core/Db/WhereClause/ArrayWhereClause.php
  34. +1 −1 src/Ouzo/Core/Db/WhereClause/EmptyWhereClause.php
  35. +2 −2 src/Ouzo/Core/Db/WhereClause/SqlWhereClause.php
  36. +1 −1 src/Ouzo/Core/Db/WhereClause/WhereClause.php
  37. +1 −1 src/Ouzo/Core/Exception/InternalException.php
  38. +1 −1 src/Ouzo/Core/Exception/NotFoundException.php
  39. +1 −1 src/Ouzo/Core/Exception/UnauthorizedException.php
  40. +1 −1 src/Ouzo/Core/Exception/ValidationException.php
  41. +3 −3 src/Ouzo/Core/ExceptionHandling/DebugErrorHandler.php
  42. +2 −2 src/Ouzo/Core/ExceptionHandling/Error.php
  43. +4 −4 src/Ouzo/Core/ExceptionHandling/ErrorHandler.php
  44. +2 −2 src/Ouzo/Core/ExceptionHandling/OuzoException.php
  45. +2 −2 src/Ouzo/Core/ExceptionHandling/OuzoExceptionData.php
  46. +1 −1 src/Ouzo/Core/Extension/AuthBasicExtension.php
  47. +5 −5 src/Ouzo/Core/FrontController.php
  48. +24 −24 src/Ouzo/Core/Helper/FormHelper.php
  49. +12 −12 src/Ouzo/Core/Helper/ModelFormBuilder.php
  50. +9 −9 src/Ouzo/Core/Helper/ViewHelper.php
  51. +3 −3 src/Ouzo/Core/Http/AcceptHeaderParser.php
  52. +2 −2 src/Ouzo/Core/Http/ResponseMapper.php
  53. +1 −1 src/Ouzo/Core/I18n.php
  54. +1 −1 src/Ouzo/Core/Logger/AbstractLogger.php
  55. +3 −3 src/Ouzo/Core/Logger/Logger.php
  56. +2 −2 src/Ouzo/Core/MetaModelCache.php
  57. +16 −16 src/Ouzo/Core/Model.php
  58. +2 −2 src/Ouzo/Core/Relations.php
  59. +1 −1 src/Ouzo/Core/Request/RequestHeaders.php
  60. +3 −3 src/Ouzo/Core/Response/ResponseTypeResolve.php
  61. +1 −1 src/Ouzo/Core/Restriction/BetweenRestriction.php
  62. +1 −1 src/Ouzo/Core/Restriction/NoValueRestriction.php
  63. +1 −1 src/Ouzo/Core/Restriction/SingleValueRestriction.php
  64. +5 −5 src/Ouzo/Core/Routing/GroupedRoute.php
  65. +14 −14 src/Ouzo/Core/Routing/Route.php
  66. +5 −5 src/Ouzo/Core/Routing/RouteInterface.php
  67. +6 −6 src/Ouzo/Core/Routing/RouteRule.php
  68. +2 −2 src/Ouzo/Core/SessionObject.php
  69. +2 −2 src/Ouzo/Core/Tests/ControllerTestCase.php
  70. +1 −1 src/Ouzo/Core/Tests/MockCookiesSetter.php
  71. +1 −1 src/Ouzo/Core/Tests/MockSessionInitializer.php
  72. +2 −2 src/Ouzo/Core/Tools/Controller/Template/ActionStubPlaceholderReplacer.php
  73. +2 −2 src/Ouzo/Core/Tools/Controller/Template/ControllerClassStubPlaceholderReplacer.php
  74. +3 −3 src/Ouzo/Core/Tools/Model/Template/ClassStub.php
  75. +1 −1 src/Ouzo/Core/Tools/Model/Template/ClassStubPlaceholderReplacer.php
  76. +1 −1 src/Ouzo/Core/Tools/Model/Template/Dialect/Dialect.php
  77. +1 −1 src/Ouzo/Core/Tools/Model/Template/Dialect/MySqlDialect.php
  78. +1 −1 src/Ouzo/Core/Tools/Model/Template/Dialect/PostgresDialect.php
  79. +1 −1 src/Ouzo/Core/Tools/Model/Template/Generator.php
  80. +4 −4 src/Ouzo/Core/Translator.php
  81. +5 −5 src/Ouzo/Core/Uri.php
  82. +2 −2 src/Ouzo/Core/Uri/JsUriHelperGenerator.php
  83. +3 −3 src/Ouzo/Core/Uri/UriHelperGenerator.php
  84. +4 −4 src/Ouzo/Core/Validatable.php
  85. +1 −1 src/Ouzo/Core/View.php
  86. +5 −5 src/Ouzo/Core/View/OuzoTwigExtension.php
  87. +1 −1 src/Ouzo/Core/View/TwigRenderer.php
  88. +2 −2 src/Ouzo/Core/ViewPathResolver.php
  89. +3 −3 src/Ouzo/Goodies/Tests/ArrayAssert.php
  90. +1 −1 src/Ouzo/Goodies/Tests/Assert.php
  91. +1 −1 src/Ouzo/Goodies/Tests/CatchException.php
  92. +1 −1 src/Ouzo/Goodies/Tests/Mock/InOrderVerifier.php
  93. +2 −2 src/Ouzo/Goodies/Tests/Mock/SimpleMock.php
  94. +1 −1 src/Ouzo/Goodies/Tests/StreamStub.php
  95. +12 −12 src/Ouzo/Goodies/Utilities/Arrays.php
  96. +2 −2 src/Ouzo/Goodies/Utilities/Cache.php
  97. +1 −1 src/Ouzo/Goodies/Utilities/DeleteDirectory.php
  98. +2 −2 src/Ouzo/Goodies/Utilities/Extractor.php
  99. +1 −1 src/Ouzo/Goodies/Utilities/Files.php
  100. +1 −1 src/Ouzo/Goodies/Utilities/FluentFunction.php
  101. +1 −1 src/Ouzo/Goodies/Utilities/FluentFunctions.php
  102. +23 −23 src/Ouzo/Goodies/Utilities/Inflector.php
  103. +1 −1 src/Ouzo/Goodies/Utilities/Iterator/BatchingIterator.php
  104. +1 −1 src/Ouzo/Goodies/Utilities/Iterator/UnbatchingIterator.php
  105. +1 −1 src/Ouzo/Goodies/Utilities/Objects.php
  106. +3 −3 src/Ouzo/Goodies/Utilities/Optional.php
  107. +2 −2 src/Ouzo/Goodies/Utilities/Path.php
  108. +1 −1 src/Ouzo/Goodies/Utilities/RecursiveStrSubstitutor.php
  109. +2 −2 src/Ouzo/Goodies/Utilities/StrSubstitutor.php
  110. +3 −3 src/Ouzo/Goodies/Utilities/Strings.php
  111. +5 −5 src/Ouzo/Goodies/Utilities/TimeAgo.php
  112. +2 −2 src/Ouzo/Inject/Injection/Annotation/DocCommentExtractor.php
  113. +1 −1 src/Ouzo/Inject/Injection/InjectorConfig.php
  114. +1 −1 src/Ouzo/Inject/Injection/InstanceRepository.php
  115. +24 −24 test/Application/Model/Test/Category.php
  116. +5 −5 test/Application/Model/Test/Manufacturer.php
  117. +4 −4 test/Application/Model/Test/ModelWithoutPrimaryKey.php
  118. +4 −4 test/Application/Model/Test/ModelWithoutSequence.php
  119. +4 −4 test/Application/Model/Test/Order.php
  120. +8 −8 test/Application/Model/Test/OrderProduct.php
  121. +10 −10 test/Application/Model/Test/Product.php
  122. +4 −4 test/Application/Model/Test/ProductWithDefaults.php
  123. +2 −2 test/Application/config/routes.php
  124. +2 −2 test/src/Ouzo/Core/AuthBasicControllerTest.php
  125. +3 −3 test/src/Ouzo/Core/ConfigTest.php
  126. +23 −23 test/src/Ouzo/Core/ControllerTest.php
  127. +5 −5 test/src/Ouzo/Core/ControllerUrlTest.php
  128. +15 −15 test/src/Ouzo/Core/Csrf/CsrfProtectorTest.php
  129. +18 −18 test/src/Ouzo/Core/Db/BatchInserterTest.php
  130. +7 −7 test/src/Ouzo/Core/Db/BatchLoadingSessionTest.php
  131. +2 −2 test/src/Ouzo/Core/Db/Dialect/DialectUtilTest.php
  132. +8 −8 test/src/Ouzo/Core/Db/Dialect/MySqlDialectTest.php
  133. +15 −15 test/src/Ouzo/Core/Db/Dialect/PostgresDialectTest.php
  134. +3 −3 test/src/Ouzo/Core/Db/EmulatedPDOPreparedStatementExecutorTest.php
  135. +5 −5 test/src/Ouzo/Core/Db/ModelOrderedRelationTest.php
  136. +3 −3 test/src/Ouzo/Core/Db/ModelQueryBuilderHelperTest.php
  137. +247 −247 test/src/Ouzo/Core/Db/ModelQueryBuilderTest.php
  138. +10 −10 test/src/Ouzo/Core/Db/ModelRelationConditionsTest.php
  139. +3 −3 test/src/Ouzo/Core/Db/PDOPreparedStatementExecutorTest.php
  140. +6 −6 test/src/Ouzo/Core/Db/PreparedStatementEmulatorTest.php
  141. +15 −15 test/src/Ouzo/Core/Db/QueryExecutorTest.php
  142. +5 −5 test/src/Ouzo/Core/Db/QueryTest.php
  143. +3 −3 test/src/Ouzo/Core/Db/RelationFactoryTest.php
  144. +4 −4 test/src/Ouzo/Core/Db/StatementEmulatorTest.php
  145. +7 −7 test/src/Ouzo/Core/Db/StatementExecutorTest.php
  146. +4 −4 test/src/Ouzo/Core/Db/StatsTest.php
  147. +2 −2 test/src/Ouzo/Core/Db/WhereClause/EmptyWhereClauseTest.php
  148. +4 −4 test/src/Ouzo/Core/Db/WhereClause/ExistsClauseTest.php
  149. +4 −4 test/src/Ouzo/Core/Db/WhereClause/SqlWhereClauseTest.php
  150. +15 −15 test/src/Ouzo/Core/Db/WhereClause/WhereClauseTest.php
  151. +1 −1 test/src/Ouzo/Core/DbFunctionTest.php
  152. +3 −3 test/src/Ouzo/Core/DbTest.php
  153. +11 −11 test/src/Ouzo/Core/FrontControllerTest.php
  154. +46 −46 test/src/Ouzo/Core/Helper/FormHelperTest.php
  155. +4 −4 test/src/Ouzo/Core/Helper/ModelFormBuilderTest.php
  156. +9 −9 test/src/Ouzo/Core/Helper/ViewHelperTest.php
  157. +4 −4 test/src/Ouzo/Core/Http/AcceptHeaderParserTest.php
  158. +1 −1 test/src/Ouzo/Core/I18nTest.php
  159. +6 −6 test/src/Ouzo/Core/Logger/StdOutputLoggerTest.php
  160. +12 −12 test/src/Ouzo/Core/ModelCallbackTest.php
  161. +7 −7 test/src/Ouzo/Core/ModelDefaultFieldValuesTest.php
  162. +15 −15 test/src/Ouzo/Core/ModelDefaultMappingTest.php
  163. +76 −76 test/src/Ouzo/Core/ModelTest.php
  164. +6 −6 test/src/Ouzo/Core/RelationsTest.php
  165. +2 −2 test/src/Ouzo/Core/Request/RequestHeadersTest.php
  166. +1 −1 test/src/Ouzo/Core/Restriction/BetweenRestrictionTest.php
  167. +1 −1 test/src/Ouzo/Core/Restriction/EqualToRestrictionTest.php
  168. +1 −1 test/src/Ouzo/Core/Restriction/GreaterOrEqualToRestrictionTest.php
  169. +1 −1 test/src/Ouzo/Core/Restriction/GreaterThanRestrictionTest.php
  170. +2 −2 test/src/Ouzo/Core/Restriction/IsInRestrictionTest.php
  171. +2 −2 test/src/Ouzo/Core/Restriction/IsNotInRestrictionTest.php
  172. +1 −1 test/src/Ouzo/Core/Restriction/LessOrEqualToRestrictionTest.php
  173. +1 −1 test/src/Ouzo/Core/Restriction/LessThanRestrictionTest.php
  174. +1 −1 test/src/Ouzo/Core/Restriction/LikeRestrictionTest.php
  175. +2 −2 test/src/Ouzo/Core/Restriction/NotEqualToRestrictionTest.php
  176. +3 −3 test/src/Ouzo/Core/Restriction/RegexpRestrictionTest.php
  177. +27 −27 test/src/Ouzo/Core/RestrictionsTest.php
  178. +4 −4 test/src/Ouzo/Core/Routing/RouteTest.php
  179. +28 −28 test/src/Ouzo/Core/Routing/RouterTest.php
  180. +6 −6 test/src/Ouzo/Core/SessionTest.php
  181. +1 −1 test/src/Ouzo/Core/StatementIteratorTest.php
  182. +10 −10 test/src/Ouzo/Core/Tests/ModelAssertTest.php
  183. +5 −5 test/src/Ouzo/Core/Tests/ModelAttributesMatcherTest.php
  184. +4 −4 test/src/Ouzo/Core/Tools/Model/Template/ClassStubPlaceholderReplacerTest.php
  185. +1 −1 test/src/Ouzo/Core/Tools/Model/Template/ClassStubTest.php
  186. +2 −2 test/src/Ouzo/Core/Tools/Model/Template/Dialect/PostgresDialectTest.php
  187. +1 −1 test/src/Ouzo/Core/Tools/Model/Template/GeneratorTest.php
  188. +4 −4 test/src/Ouzo/Core/Tools/Model/Template/TableInfoTest.php
  189. +14 −14 test/src/Ouzo/Core/TranslatableTimeAgoTest.php
  190. +17 −17 test/src/Ouzo/Core/TranslatorTest.php
  191. +1 −1 test/src/Ouzo/Core/Uri/JsUriHelperGeneratorTest.php
  192. +1 −1 test/src/Ouzo/Core/Uri/UriHelperGeneratorTest.php
  193. +18 −18 test/src/Ouzo/Core/UriTest.php
  194. +15 −15 test/src/Ouzo/Core/ValidatableTest.php
  195. +2 −2 test/src/Ouzo/Core/ValidatableValidateUniqueTest.php
  196. +2 −2 test/src/Ouzo/Core/View/PhtmlRendererTest.php
  197. +4 −4 test/src/Ouzo/Core/View/ViewRendererFactoryTest.php
  198. +90 −90 test/src/Ouzo/Goodies/Tests/ArrayAssertTest.php
  199. +26 −26 test/src/Ouzo/Goodies/Tests/BooleanAssertTest.php
  200. +31 −31 test/src/Ouzo/Goodies/Tests/GeneralAssertTest.php
  201. +14 −14 test/src/Ouzo/Goodies/Tests/Mock/MethodCallMatcherTest.php
  202. +2 −2 test/src/Ouzo/Goodies/Tests/Mock/MockTest.php
  203. +99 −99 test/src/Ouzo/Goodies/Utilities/ArrayContainFunctionsTest.php
  204. +178 −178 test/src/Ouzo/Goodies/Utilities/ArraysTest.php
  205. +17 −17 test/src/Ouzo/Goodies/Utilities/BooleansTest.php
  206. +7 −7 test/src/Ouzo/Goodies/Utilities/DateTest.php
  207. +9 −9 test/src/Ouzo/Goodies/Utilities/DynamicProxyTest.php
  208. +6 −6 test/src/Ouzo/Goodies/Utilities/ExtractorTest.php
  209. +10 −10 test/src/Ouzo/Goodies/Utilities/FilesTest.php
  210. +39 −39 test/src/Ouzo/Goodies/Utilities/FluentArrayTest.php
  211. +1 −1 test/src/Ouzo/Goodies/Utilities/FluentFunctionTest.php
  212. +4 −4 test/src/Ouzo/Goodies/Utilities/FunctionsTest.php
  213. +73 −73 test/src/Ouzo/Goodies/Utilities/InflectorTest.php
  214. +9 −9 test/src/Ouzo/Goodies/Utilities/Iterator/BatchingIteratorTest.php
  215. +17 −17 test/src/Ouzo/Goodies/Utilities/Iterator/FluentIteratorTest.php
  216. +2 −2 test/src/Ouzo/Goodies/Utilities/Iterator/UnbatchingIteratorTest.php
  217. +17 −17 test/src/Ouzo/Goodies/Utilities/JoinerTest.php
  218. +24 −24 test/src/Ouzo/Goodies/Utilities/JsonTest.php
  219. +42 −42 test/src/Ouzo/Goodies/Utilities/ObjectsTest.php
  220. +3 −3 test/src/Ouzo/Goodies/Utilities/RecursiveStrSubstitutorTest.php
  221. +7 −7 test/src/Ouzo/Goodies/Utilities/StrSubstitutorTest.php
  222. +5 −5 test/src/Ouzo/Goodies/Utilities/StringsTest.php
  223. +14 −14 test/src/Ouzo/Goodies/Utilities/TimeAgoTest.php
View
@@ -42,11 +42,11 @@ public function execute(InputInterface $input, OutputInterface $output)
{
$this->_input = $input;
$this->_output = $output;
$generateOptionFunctionMap = array(
$generateOptionFunctionMap = [
"generate-php" => "generatePhpHelper",
"generate-js" => "generateJsHelper",
"generate-all" => "generateAllHelpers",
);
];
$selectedOptions = array_filter($input->getOptions());
$selectedGeneratedOptions = array_intersect(array_keys($selectedOptions), array_keys($generateOptionFunctionMap));
@@ -104,16 +104,16 @@ private function all()
$this->_renderRoutes(Route::getRoutes());
}
private function _renderRoutes($routes = array())
private function _renderRoutes($routes = [])
{
$table = $this->getHelper('table');
$table->setHeaders(array('URL Helper', 'HTTP Verb', 'Path', 'Controller#Action'));
$table->setHeaders(['URL Helper', 'HTTP Verb', 'Path', 'Controller#Action']);
foreach ($routes as $route) {
$method = $this->_getRuleMethod($route);
$action = $route->getAction() ? '#' . $route->getAction() : $route->getAction();
$controllerAction = $route->getController() . $action;
$table->addRow(array($route->getName(), $method, $route->getUri(), $controllerAction));
$table->addRow([$route->getName(), $method, $route->getUri(), $controllerAction]);
$this->_printExceptIfExists($route, $table);
}
@@ -132,9 +132,9 @@ private function _printExceptIfExists(RouteRule $rule, $table)
{
$except = $rule->getExcept();
if ($except) {
$table->addRow(array('', '', ' <info>except:</info>', ''));
$table->addRow(['', '', ' <info>except:</info>', '']);
Arrays::map($except, function ($except) use ($table) {
$table->addRow(array('', '', ' ' . $except, ''));
$table->addRow(['', '', ' ' . $except, '']);
return $except;
});
}
View
@@ -16,7 +16,7 @@ require 'vendor/autoload.php';
Files::loadIfExists(ROOT_PATH . 'test/Application/config/routes.php');
$app = new Application();
$app->addCommands(array(
$app->addCommands([
new ConsoleCommand(), new RoutesCommand(), new ModelGeneratorCommand(), new ControllerGeneratorCommand()
));
]);
$app->run();
View
@@ -1,18 +1,18 @@
<?php
return array(
'product' => array(
return [
'product' => [
'description' => 'Product description',
'id_category' => 'Category>"ID"',
'quantity' => '%{count} product|%{count} products'
),
'timeAgo' => array(
],
'timeAgo' => [
'justNow' => 'just now',
'minAgo' => '%{label} min. ago',
'todayAt' => 'today at %{label}',
'yesterdayAt' => 'yesterday at %{label}',
'thisYear' => '%{month} %{day}',
'month' => array(
'month' => [
'1' => 'Jan',
'2' => 'Feb',
'3' => 'Mar',
@@ -25,6 +25,6 @@
'10' => 'Oct',
'11' => 'Nov',
'12' => 'Dec'
)
)
);
]
]
];
View
@@ -1,7 +1,7 @@
<?php
return array(
'product' => array(
return [
'product' => [
'description' => 'Opis produktu'
)
);
]
];
@@ -12,7 +12,7 @@ class AutoloadNamespaces
public static function getControllerNamespace()
{
$controllerPath = Config::getValue('namespace', 'controller');
return $controllerPath ? Arrays::toArray($controllerPath) : array("\\Application\\Controller\\");
return $controllerPath ? Arrays::toArray($controllerPath) : ["\\Application\\Controller\\"];
}
public static function getModelNamespace()
@@ -13,9 +13,9 @@
class ConfigRepository
{
private $_customConfigs = array();
private $_config = array();
private $_overriddenConfig = array();
private $_customConfigs = [];
private $_config = [];
private $_overriddenConfig = [];
public function reload()
{
@@ -37,12 +37,12 @@ private function _getConfigEnv()
/** @noinspection PhpIncludeInspection */
return require($configPath);
}
return array();
return [];
}
private function _getConfigCustom()
{
$result = array();
$result = [];
foreach ($this->_customConfigs as $config) {
$result = array_replace_recursive($result, $config->getConfig());
}
@@ -51,7 +51,7 @@ private function _getConfigCustom()
private function _getConfigFromSession()
{
return Session::get('config') ? : array();
return Session::get('config') ? : [];
}
public function overrideProperty($keys, $value)
@@ -19,17 +19,17 @@ class Controller
/** @var Layout */
public $layout;
public $before = array();
public $after = array();
public $before = [];
public $after = [];
public $currentController = '';
public $currentAction = '';
public $params;
private $_statusResponse = 'show';
private $_redirectLocation = '';
private $_fileData = array();
private $_headers = array();
private $_cookies = array();
private $_fileData = [];
private $_headers = [];
private $_cookies = [];
private $_routeRule = null;
private $_keepMessage = false;
@@ -76,7 +76,7 @@ public function getNewCookies()
return $this->_cookies;
}
public function redirect($url, $messages = array())
public function redirect($url, $messages = [])
{
$url = trim($url);
$this->notice($messages, false, $url);
@@ -87,7 +87,7 @@ public function redirect($url, $messages = array())
public function downloadFile($label, $mime, $path, $type = 'file')
{
$this->_fileData = array('label' => $label, 'mime' => $mime, 'path' => $path);
$this->_fileData = ['label' => $label, 'mime' => $mime, 'path' => $path];
$this->_statusResponse = $type;
}
@@ -38,7 +38,7 @@ private static function _createUrlFromArray($params)
$action = Arrays::getValue($params, 'action');
$extraParams = Arrays::getValue($params, 'extraParams');
if ($controller && $action) {
$url = Joiner::on('/')->join(array($prefixSystem, $controller, $action));
$url = Joiner::on('/')->join([$prefixSystem, $controller, $action]);
if ($extraParams) {
$url .= self::_mergeParams($extraParams);
}
@@ -25,12 +25,12 @@ public static function protect(Controller $controller)
return true;
};
$controller->after[] = function () use ($controller) {
$controller->setCookie(array(
$controller->setCookie([
'name' => 'csrftoken',
'value' => CsrfProtector::getCsrfToken(),
'expire' => 0,
'path' => '/'
));
]);
return true;
};
}
@@ -52,7 +52,7 @@ public static function validate()
public static function isMethodProtected($method)
{
return !in_array($method, array('GET', 'HEAD', 'OPTIONS', 'TRACE'));
return !in_array($method, ['GET', 'HEAD', 'OPTIONS', 'TRACE']);
}
public static function getCsrfToken()
View
@@ -41,10 +41,10 @@ public static function getInstance()
return self::$_instance;
}
public function connectDb($params = array())
public function connectDb($params = [])
{
$this->_dbHandle = $this->_createPdo($params);
$attributes = Arrays::getValue($params, 'attributes', array());
$attributes = Arrays::getValue($params, 'attributes', []);
foreach ($attributes as $attribute => $value) {
$this->_dbHandle->setAttribute($attribute, $value);
}
@@ -55,11 +55,11 @@ public static function callFunction($functionName, $parameters)
{
$db = self::getInstance();
$bindParams = Arrays::toArray($parameters);
$paramsQueryString = implode(',', array_pad(array(), sizeof($bindParams), '?'));
$paramsQueryString = implode(',', array_pad([], sizeof($bindParams), '?'));
return Arrays::first($db->query("SELECT $functionName($paramsQueryString)", $parameters)->fetch());
}
public function query($query, $params = array(), $options = array())
public function query($query, $params = [], $options = [])
{
return StatementExecutor::prepare($this->_dbHandle, $query, $params, $options);
}
@@ -71,7 +71,7 @@ public function query($query, $params = array(), $options = array())
* @param array $options
* @return int
*/
public function execute($query, $params = array(), $options = array())
public function execute($query, $params = [], $options = [])
{
return StatementExecutor::prepare($this->_dbHandle, $query, $params, $options)->execute();
}
@@ -143,7 +143,7 @@ private function _buildDsn($params)
private function _createPdo($params)
{
$dsn = Arrays::getValue($params, 'dsn');
$options = Arrays::getValue($params, 'options', array());
$options = Arrays::getValue($params, 'options', []);
if ($dsn) {
return new PDO($dsn, '', '', $options);
}
@@ -17,7 +17,7 @@ class BatchInserter
/**
* @var Model[]
*/
private $_models = array();
private $_models = [];
public function add(Model $model)
{
@@ -72,7 +72,7 @@ public function _callAfterSaveCallbacks()
public function _prepareParams($primaryKey)
{
$allValues = array();
$allValues = [];
foreach ($this->_models as $model) {
$attributes = $model->definedAttributes();
unset($attributes[$primaryKey]);
@@ -9,16 +9,16 @@
class BatchLoadingSession
{
private $queryResultsById = array();
private $queryResultsById = [];
private static $currentSession;
public static function getBatch(Model $model)
{
if (self::isAllocated()) {
return Arrays::getValue(BatchLoadingSession::$currentSession->queryResultsById, spl_object_hash($model), array($model));
return Arrays::getValue(BatchLoadingSession::$currentSession->queryResultsById, spl_object_hash($model), [$model]);
}
return array($model);
return [$model];
}
public static function isAllocated()
@@ -68,7 +68,7 @@ public static function buildUsingQuery($usingClauses, $glue, $table, $alias)
->toArray();
if ($usingClauses && $table) {
$tableElement = $table . ($alias ? " AS {$alias}" : "");
$elements = array_merge(array($tableElement), $elements);
$elements = array_merge([$tableElement], $elements);
}
return implode($glue, $elements);
}
@@ -24,7 +24,7 @@ public function table()
public function getConnectionErrorCodes()
{
return array(2003, 2006);
return [2003, 2006];
}
public function getErrorCode($errorInfo)
@@ -11,7 +11,7 @@ class PostgresDialect extends Dialect
{
public function getConnectionErrorCodes()
{
return array('57000', '57014', '57P01', '57P02', '57P03');
return ['57000', '57014', '57P01', '57P02', '57P03'];
}
public function getErrorCode($errorInfo)
@@ -15,7 +15,7 @@ class Sqlite3Dialect extends Dialect
{
public function getConnectionErrorCodes()
{
return array(10, 11, 14);
return [10, 11, 14];
}
public function getErrorCode($errorInfo)
@@ -16,12 +16,12 @@ public function fetch()
public function fetchAll()
{
return array();
return [];
}
public function fetchIterator()
{
return new ArrayIterator(array());
return new ArrayIterator([]);
}
public function execute()
@@ -24,11 +24,11 @@ class ModelDefinition
/** @var Relations */
public $relations;
public $afterSaveCallbacks = array();
public $beforeSaveCallbacks = array();
public $defaults = array();
public $afterSaveCallbacks = [];
public $beforeSaveCallbacks = [];
public $defaults = [];
private static $cache = array();
private static $cache = [];
public function __construct(Db $db, $table, $sequence, $primaryKey, $fields, $relations, array $afterSaveCallbacks, array $beforeSaveCallbacks, $defaults)
{
@@ -45,7 +45,7 @@ public function __construct(Db $db, $table, $sequence, $primaryKey, $fields, $re
public static function resetCache()
{
self::$cache = array();
self::$cache = [];
}
/**
@@ -110,8 +110,8 @@ private static function _createDefinition($class, $params)
private static function _extractFieldsAndDefaults($fields)
{
$newFields = array();
$defaults = array();
$newFields = [];
$defaults = [];
foreach ($fields as $key => $value) {
if (is_numeric($key)) {
$newFields[] = $value;
@@ -120,6 +120,6 @@ private static function _extractFieldsAndDefaults($fields)
$defaults[$key] = $value;
}
}
return array($newFields, $defaults);
return [$newFields, $defaults];
}
}
Oops, something went wrong.

0 comments on commit a7e80bc

Please sign in to comment.