From 7efc79db51af95a5e5ea7b21036c4ad87fb3346c Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 10 Feb 2019 00:37:28 +0100 Subject: [PATCH 01/56] move classes to namespace JoindIn\Web --- app/src/Apikey/ApikeyApi.php | 4 +- app/src/Apikey/ApikeyController.php | 5 +- app/src/Apikey/ApikeyDeleteFormType.php | 4 +- app/src/Apikey/ApikeyEntity.php | 4 +- app/src/Application/ApplicationController.php | 11 +-- app/src/Application/BaseApi.php | 2 +- app/src/Application/BaseCommentEntity.php | 4 +- .../BaseCommentReportingEntity.php | 3 +- app/src/Application/BaseController.php | 2 +- app/src/Application/BaseDb.php | 4 +- app/src/Application/BaseEntity.php | 2 +- app/src/Application/CacheService.php | 2 +- app/src/Application/Config.php | 2 +- app/src/Application/ContactApi.php | 4 +- app/src/Application/ContactFormType.php | 6 +- app/src/Client/ClientApi.php | 6 +- app/src/Client/ClientController.php | 4 +- app/src/Client/ClientDeleteFormType.php | 4 +- app/src/Client/ClientEntity.php | 4 +- app/src/Client/ClientFormType.php | 4 +- app/src/Event/Constraint/ValidEventIcon.php | 2 +- .../Constraint/ValidEventIconValidator.php | 2 +- app/src/Event/EventApi.php | 12 +-- app/src/Event/EventCommentEntity.php | 4 +- app/src/Event/EventCommentReportEntity.php | 4 +- app/src/Event/EventController.php | 24 +++--- app/src/Event/EventDb.php | 6 +- app/src/Event/EventEntity.php | 4 +- app/src/Event/EventFormType.php | 9 +- app/src/Event/EventScheduler.php | 4 +- app/src/Event/EventSchedulerDay.php | 2 +- app/src/Event/TrackApi.php | 4 +- app/src/Event/TrackCollectionFormType.php | 2 +- app/src/Event/TrackFormType.php | 2 +- .../Form/DataTransformer/DateTransformer.php | 2 +- .../DataTransformer/EventTagsTransformer.php | 2 +- app/src/Language/LanguageApi.php | 4 +- app/src/Middleware/FormMiddleware.php | 2 +- app/src/Middleware/ValidationMiddleware.php | 2 +- app/src/Search/SearchController.php | 18 ++-- app/src/Talk/SpeakerFormType.php | 4 +- app/src/Talk/TalkApi.php | 7 +- app/src/Talk/TalkCommentEntity.php | 4 +- app/src/Talk/TalkCommentReportEntity.php | 4 +- app/src/Talk/TalkController.php | 22 ++--- app/src/Talk/TalkDb.php | 6 +- app/src/Talk/TalkDeleteFormType.php | 4 +- app/src/Talk/TalkEntity.php | 4 +- app/src/Talk/TalkFormType.php | 5 +- app/src/Talk/TalkMediaFormType.php | 3 +- app/src/Talk/TalkTypeApi.php | 4 +- app/src/User/AuthApi.php | 4 +- app/src/User/EmailInputFormType.php | 2 +- app/src/User/NewPasswordFormType.php | 2 +- app/src/User/RegisterFormType.php | 2 +- app/src/User/UserApi.php | 5 +- app/src/User/UserController.php | 21 ++--- app/src/User/UserDb.php | 6 +- app/src/User/UserEntity.php | 4 +- app/src/User/UserFormType.php | 2 +- app/src/User/UsernameInputFormType.php | 2 +- app/src/View/FiltersExtension.php | 2 +- app/src/View/FunctionsExtension.php | 2 +- composer.json | 17 ++-- tests/Event/EventApiTest.php | 42 ++++----- tests/Event/EventCommentEntityTest.php | 4 +- tests/Event/EventEntityTest.php | 4 +- tests/Talk/TalkCommentEntityTest.php | 4 +- tests/View/TwigExtensionIntegrationsTest.php | 6 +- web/index.php | 86 +++++++++---------- 70 files changed, 240 insertions(+), 236 deletions(-) diff --git a/app/src/Apikey/ApikeyApi.php b/app/src/Apikey/ApikeyApi.php index 9dbd9ddc6..ebdf03b8a 100644 --- a/app/src/Apikey/ApikeyApi.php +++ b/app/src/Apikey/ApikeyApi.php @@ -1,7 +1,7 @@ getTalkDb(); $slugs = array(); - /** @var \Talk\TalkCommentEntity $comment */ + /** @var \JoindIn\Web\Talk\TalkCommentEntity $comment */ foreach ($comments as $comment) { $slugs[$comment->getTalkUri()] = $talkDb->getSlugFor($comment->getTalkUri()); } @@ -1198,7 +1198,7 @@ private function getTalkSlugsFromApi(EventEntity $event) array('resultsperpage' => 100) // Make sure we get all talks with a single request ); - /** @var \Talk\TalkEntity $talk */ + /** @var \JoindIn\Web\Talk\TalkEntity $talk */ foreach ($talks['talks'] as $talk) { $slugs[$talk->getApiUri()] = $talk->getUrlFriendlyTalkTitle(); } diff --git a/app/src/Event/EventDb.php b/app/src/Event/EventDb.php index 8675ab98e..d09630299 100644 --- a/app/src/Event/EventDb.php +++ b/app/src/Event/EventDb.php @@ -1,8 +1,8 @@ [ 'class'=>'file', ], - 'constraints' => [new Constraint\ValidEventIcon(['groupname' => 'event', 'keyname'=>'new_icon'])], + 'constraints' => [new \JoindIn\Web\Event\Constraint\ValidEventIcon(['groupname' => 'event', 'keyname' =>'new_icon'])], ] ) ; diff --git a/app/src/Event/EventScheduler.php b/app/src/Event/EventScheduler.php index 3afd2d706..f12236855 100644 --- a/app/src/Event/EventScheduler.php +++ b/app/src/Event/EventScheduler.php @@ -1,7 +1,7 @@ get('/user/logout', array($this, 'logout'))->name('user-logout'); $app->map('/user/login', array($this, 'login'))->via('GET', 'POST')->name('user-login'); diff --git a/app/src/User/UserDb.php b/app/src/User/UserDb.php index 5b20a0d8a..600179709 100644 --- a/app/src/User/UserDb.php +++ b/app/src/User/UserDb.php @@ -1,8 +1,8 @@ mockPredisClient = $this->getMockBuilder(Client::class) ->getMock(); - $this->mockCache = $this->getMockBuilder('Application\CacheService') + $this->mockCache = $this->getMockBuilder('JoindIn\Web\Application\CacheService') ->setConstructorArgs(array($this->mockPredisClient)) ->getMock(); - $this->mockDbEvent = $this->getMockBuilder('Event\EventDb') + $this->mockDbEvent = $this->getMockBuilder('JoindIn\Web\Event\EventDb') ->setConstructorArgs(array($this->mockCache)) ->getMock(); - $this->mockUserDb = $this->getMockBuilder('User\UserDb') + $this->mockUserDb = $this->getMockBuilder('JoindIn\Web\User\UserDb') ->setConstructorArgs(array($this->mockCache)) ->getMock(); - $this->mockUserApi = $this->getMockBuilder('User\UserApi') + $this->mockUserApi = $this->getMockBuilder('JoindIn\Web\User\UserApi') ->setConstructorArgs(array($this->mockConfig, null, $this->mockUserDb)) ->getMock(); } public function testDefaultgetEventsParametersAreSet() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock() @@ -55,7 +55,7 @@ public function testDefaultgetEventsParametersAreSet() public function testgetEventsWithLimitSetsParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -71,7 +71,7 @@ public function testgetEventsWithLimitSetsParamsCorrectly() public function testgetEventsWithPageValueSetsParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -87,7 +87,7 @@ public function testgetEventsWithPageValueSetsParamsCorrectly() public function testgetEventsWithFilterSetsAllParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -103,7 +103,7 @@ public function testgetEventsWithFilterSetsAllParamsCorrectly() public function testgetEventsWithVerboseSetsAllParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -119,7 +119,7 @@ public function testgetEventsWithVerboseSetsAllParamsCorrectly() public function testgetEventsWithQueryParamsPassesThemThroughCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -140,7 +140,7 @@ public function testAddCommentPostsAComment() { // The object containing the event details (in this case, we only // need to mock the comments_uri and its getter - $mockEventObj = $this->getMockBuilder('Event\EventEntity') + $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') ->setMethods(array('getCommentsUri')) ->setConstructorArgs(array( (object) array('comments_uri'=>'http://example.com/comments/123') @@ -155,7 +155,7 @@ public function testAddCommentPostsAComment() // We need to create the Event API class, and mock the call to the // joind.in API to return a known result and check we're making the // correct call - $mockEventApi = $this->getMockBuilder('Event\EventApi') + $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiPost')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -184,7 +184,7 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus() { // The object containing the event details (in this case, we only // need to mock the comments_uri and its getter - $mockEventObj = $this->getMockBuilder('Event\EventEntity') + $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') ->setMethods(array('getCommentsUri')) ->setConstructorArgs(array( (object) array('comments_uri'=>'http://example.com/comments/123') @@ -199,7 +199,7 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus() // We need to create the Event API class, and mock the call to the // joind.in API to return a known (failed) result and check we're making the // correct call - $mockEventApi = $this->getMockBuilder('Event\EventApi') + $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiPost')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -222,7 +222,7 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus() public function testAttendThrowsExceptionIfAPIReturnsBadStatus() { - $mockEventObj = $this->getMockBuilder('Event\EventEntity') + $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') ->setMethods(array('getApiUriToMarkAsAttending')) ->setConstructorArgs(array( (object) array('attending_uri'=>'http://example.com/events/1/attending') @@ -234,7 +234,7 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus() ->will($this->returnValue('http://example.com/events/1/attending')); - $mockEventApi = $this->getMockBuilder('Event\EventApi') + $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiPost')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -253,7 +253,7 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus() public function testDefaultGetTalkCommentsParametersAreSet() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -269,7 +269,7 @@ public function testDefaultGetTalkCommentsParametersAreSet() public function testGetTalkCommentsWithLimitSetsParamsCorrectly() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -285,7 +285,7 @@ public function testGetTalkCommentsWithLimitSetsParamsCorrectly() public function testGetTalkCommentsWithStartValueSetsParamsCorrectly() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -301,7 +301,7 @@ public function testGetTalkCommentsWithStartValueSetsParamsCorrectly() public function testGetTalkCommentsWithVerboseSetsAllParamsCorrectly() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); diff --git a/tests/Event/EventCommentEntityTest.php b/tests/Event/EventCommentEntityTest.php index e3a61a4e0..3647cb591 100644 --- a/tests/Event/EventCommentEntityTest.php +++ b/tests/Event/EventCommentEntityTest.php @@ -1,7 +1,7 @@ view()->parserDirectory = realpath(__DIR__ . '/../vendor/Twig/lib/Twig'); $app->view()->setTemplatesDirectory('../app/templates'); -$app->view()->getEnvironment()->addExtension(new \View\FiltersExtension()); +$app->view()->getEnvironment()->addExtension(new \JoindIn\Web\View\FiltersExtension()); $app->view()->getEnvironment()->addExtension(new \Slim\Views\TwigExtension()); -$app->view()->getEnvironment()->addExtension(new \View\FunctionsExtension($app)); +$app->view()->getEnvironment()->addExtension(new \JoindIn\Web\View\FunctionsExtension($app)); if (isset($config['slim']['twig']['cache'])) { $app->view()->getEnvironment()->setCache($config['slim']['twig']['cache']); @@ -89,18 +89,18 @@ }); // register middlewares -$app->add(new Middleware\ValidationMiddleware()); +$app->add(new \JoindIn\Web\Middleware\ValidationMiddleware()); $csrfSecret = null; if (!empty($config['slim']['custom']['csrfSecret'])) { $csrfSecret = $config['slim']['custom']['csrfSecret']; } -$app->add(new Middleware\FormMiddleware($csrfSecret)); +$app->add(new \JoindIn\Web\Middleware\FormMiddleware($csrfSecret)); // register services $app->container->set('access_token', isset($_SESSION['access_token']) ? $_SESSION['access_token'] : null); -$app->container->singleton(\Application\CacheService::class, function ($container) { +$app->container->singleton(\JoindIn\Web\Application\CacheService::class, function ($container) { $redisServer = null; if ($host = getenv('REDIS_HOST')) { $redisServer = "tcp://$host:6379"; @@ -108,67 +108,67 @@ $client = new Predis\Client($redisServer); $keyPrefix = $container->settings['custom']['redisKeyPrefix']; - return new \Application\CacheService($client, $keyPrefix); + return new \JoindIn\Web\Application\CacheService($client, $keyPrefix); }); -$app->container->singleton(\Application\ContactApi::class, function ($container) { - return new \Application\ContactApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Application\ContactApi::class, function ($container) { + return new \JoindIn\Web\Application\ContactApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\User\UserDb::class, function ($container) { - return new \User\UserDb($container[\Application\CacheService::class]); +$app->container->singleton(\JoindIn\Web\User\UserDb::class, function ($container) { + return new \JoindIn\Web\User\UserDb($container[\JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\User\UserApi::class, function ($container) { - return new \User\UserApi( +$app->container->singleton(\JoindIn\Web\User\UserApi::class, function ($container) { + return new \JoindIn\Web\User\UserApi( $container['settings']['custom'], $container['access_token'], - $container[\User\UserDb::class] + $container[\JoindIn\Web\User\UserDb::class] ); }); -$app->container->singleton(\Event\EventDb::class, function ($container) { - return new \Event\EventDb($container[\Application\CacheService::class]); +$app->container->singleton(\JoindIn\Web\Event\EventDb::class, function ($container) { + return new \JoindIn\Web\Event\EventDb($container[\JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\Event\EventApi::class, function ($container) { - return new \Event\EventApi( +$app->container->singleton(\JoindIn\Web\Event\EventApi::class, function ($container) { + return new \JoindIn\Web\Event\EventApi( $container['settings']['custom'], $container['access_token'], - $container[\Event\EventDb::class], - $container[\User\UserApi::class] + $container[\JoindIn\Web\Event\EventDb::class], + $container[\JoindIn\Web\User\UserApi::class] ); }); -$app->container->singleton(\Talk\TalkDb::class, function ($container) { - return new \Talk\TalkDb($container[\Application\CacheService::class]); +$app->container->singleton(\JoindIn\Web\Talk\TalkDb::class, function ($container) { + return new \JoindIn\Web\Talk\TalkDb($container[\JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\Talk\TalkApi::class, function ($container) { - return new \Talk\TalkApi( +$app->container->singleton(\JoindIn\Web\Talk\TalkApi::class, function ($container) { + return new \JoindIn\Web\Talk\TalkApi( $container['settings']['custom'], $container['access_token'], - new \Talk\TalkDb($container[\Application\CacheService::class]), - $container[\User\UserApi::class] + new \JoindIn\Web\Talk\TalkDb($container[\JoindIn\Web\Application\CacheService::class]), + $container[\JoindIn\Web\User\UserApi::class] ); }); -$app->container->singleton(\User\AuthApi::class, function ($container) { - return new \User\AuthApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\User\AuthApi::class, function ($container) { + return new \JoindIn\Web\User\AuthApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Language\LanguageApi::class, function ($container) { - return new \Language\LanguageApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Language\LanguageApi::class, function ($container) { + return new \JoindIn\Web\Language\LanguageApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Talk\TalkTypeApi::class, function ($container) { - return new \Talk\TalkTypeApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Talk\TalkTypeApi::class, function ($container) { + return new \JoindIn\Web\Talk\TalkTypeApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Event\TrackApi::class, function ($container) { - return new \Event\TrackApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Event\TrackApi::class, function ($container) { + return new \JoindIn\Web\Event\TrackApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Client\ClientApi::class, function ($container) { - return new \Client\ClientApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Client\ClientApi::class, function ($container) { + return new \JoindIn\Web\Client\ClientApi($container['settings']['custom'], $container['access_token']); }); // register routes -new Application\ApplicationController($app); -new Event\EventController($app); -new Search\SearchController($app); -new User\UserController($app); -new Talk\TalkController($app); -new Client\ClientController($app); -new Apikey\ApikeyController($app); +new \JoindIn\Web\Application\ApplicationController($app); +new \JoindIn\Web\Event\EventController($app); +new \JoindIn\Web\Search\SearchController($app); +new \JoindIn\Web\User\UserController($app); +new \JoindIn\Web\Talk\TalkController($app); +new \JoindIn\Web\Client\ClientController($app); +new \JoindIn\Web\Apikey\ApikeyController($app); // execute application $app->run(); From 52b4b8c5e4e1f33c9f8b51bf94f6a827514df09f Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 08:28:02 +0100 Subject: [PATCH 02/56] move tests/phpunit.xml to phpunit.xml.dist --- build.sh | 2 +- build.xml | 2 +- phpunit.xml.dist | 28 ++++++++++++++++++++++++++++ tests/phpunit.xml | 19 ------------------- 4 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 phpunit.xml.dist delete mode 100644 tests/phpunit.xml diff --git a/build.sh b/build.sh index c89b9b5d0..876691cc3 100755 --- a/build.sh +++ b/build.sh @@ -13,4 +13,4 @@ vendor/bin/phpcs \ php vendor/bin/security-checker security:check composer.lock -vendor/bin/phpunit -c tests/phpunit.xml \ No newline at end of file +vendor/bin/phpunit diff --git a/build.xml b/build.xml index a3e757298..e131b41dc 100644 --- a/build.xml +++ b/build.xml @@ -32,7 +32,7 @@ - + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..2a7f4df18 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + tests/ + + + + + + + + + + + app + + + diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index 22b874317..000000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - . - - - - - - - - - - - ../app - - - From c3a2bdaf7a64e44a50ff0b593cfd9f8d82cf5e9a Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 09:00:43 +0100 Subject: [PATCH 03/56] fix references --- app/src/User/UserController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index a8c91f60d..ab43ce715 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -2,16 +2,15 @@ namespace JoindIn\Web\User; use JoindIn\Web\Application\BaseController; -use JoindIn\Web\Application\CacheService; use Symfony\Component\Form\FormError; use Slim\Slim; use JoindIn\Web\Talk\TalkDb; use JoindIn\Web\Talk\TalkApi; use JoindIn\Web\Event\EventDb; use JoindIn\Web\Event\EventApi; -use Symfony\Component\Form\Form; use Symfony\Component\Form\FormFactoryInterface; -use stdclass; +use stdClass; +use Symfony\Component\Form\FormInterface; class UserController extends BaseController { @@ -859,8 +858,8 @@ public function accessTokenFromFacebook() * Process a user login result. If result is false, then we failed, otherwise * update the session. * - * @param \stdClass|false $result - * @param string $redirect + * @param stdClass|false $result + * @param string $redirect * @return void */ protected function handleLogin($result, $redirect = '') From 376d586f6a5b5294d52bd81fde1fd01263f62069 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 09:02:18 +0100 Subject: [PATCH 04/56] fix deprecations and remove unneeded/invalid parameters on the ConstraintValidatorFactory --- app/src/Middleware/ValidationMiddleware.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/Middleware/ValidationMiddleware.php b/app/src/Middleware/ValidationMiddleware.php index b5f179da5..0bdc93153 100644 --- a/app/src/Middleware/ValidationMiddleware.php +++ b/app/src/Middleware/ValidationMiddleware.php @@ -9,9 +9,11 @@ use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\ConstraintValidatorFactory; use Symfony\Component\Validator\Mapping\ClassMetadataFactory; +use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\ValidatorInterface; /** * In this middleware we create the validation services as provided by Symfony and register it as service in the @@ -74,15 +76,14 @@ function () use ($middleware) { * * @see self::call() where this method is used to construct a shared instance in Slim. * - * @return Validator + * @return ValidatorInterface */ public function createValidator() { $validator = Validation::createValidatorBuilder() - ->setMetadataFactory(new ClassMetadataFactory(new StaticMethodLoader())) - ->setConstraintValidatorFactory(new ConstraintValidatorFactory($this->app, array())) + ->setMetadataFactory(new LazyLoadingMetadataFactory(new StaticMethodLoader())) + ->setConstraintValidatorFactory(new ConstraintValidatorFactory()) ->setTranslator($this->getTranslator()) - ->setApiVersion(Validation::API_VERSION_2_5) ->getValidator(); return $validator; From d37cc8f6ffc9bf5d86ad9496912f7ef6e70aed80 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 09:02:53 +0100 Subject: [PATCH 05/56] adds .idea to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ea32386c1..9647fffe3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea build/ web/css/site.css web/js/site.js @@ -5,4 +6,4 @@ vendor/.git node_modules/ .DS_Store web/inc -vendor/ \ No newline at end of file +vendor/ From 459b1f3a2bdfbb59d083683d21703e5871a63fef Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 21:40:45 +0100 Subject: [PATCH 06/56] fix deprecated DefaultCsrfProvider --- app/src/Middleware/FormMiddleware.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index ecabf326c..94110aab0 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -14,6 +14,9 @@ use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\Forms; use Symfony\Component\Form\ResolvedFormTypeFactory; +use Symfony\Component\Security\Csrf\CsrfTokenManager; +use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator; +use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage; use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\Loader\XliffFileLoader; use Symfony\Component\Translation\MessageSelector; @@ -106,8 +109,15 @@ function () use ($formMiddleWare, $csrfSecret) { */ public function createFormFactory($csrfSecret) { + $builder = Forms::createFormFactoryBuilder() - ->addExtension(new CsrfExtension(new DefaultCsrfProvider($csrfSecret))) + ->addExtension( + new CsrfExtension( + new CsrfTokenManager( + new UriSafeTokenGenerator(), new NativeSessionTokenStorage() + ) + ) + ) ->setResolvedTypeFactory(new ResolvedFormTypeFactory()); if ($this->app->validator) { From 7f80f55f1c1a144d531aaa7f1147d0c5fbc5fa82 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 23:54:52 +0100 Subject: [PATCH 07/56] remove unused references --- app/src/Middleware/FormMiddleware.php | 1 - app/src/Middleware/ValidationMiddleware.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 94110aab0..979706ebe 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -8,7 +8,6 @@ use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; -use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; use Symfony\Component\Form\FormFactoryBuilder; use Symfony\Component\Form\FormFactoryInterface; diff --git a/app/src/Middleware/ValidationMiddleware.php b/app/src/Middleware/ValidationMiddleware.php index 0bdc93153..ce2ca8322 100644 --- a/app/src/Middleware/ValidationMiddleware.php +++ b/app/src/Middleware/ValidationMiddleware.php @@ -8,10 +8,8 @@ use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\Mapping\ClassMetadataFactory; use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; -use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\ValidatorInterface; From 7f65fdb57517513028a5a303ff48ec30760423b8 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 10 Feb 2019 00:37:28 +0100 Subject: [PATCH 08/56] move classes to namespace JoindIn\Web --- app/src/Apikey/ApikeyApi.php | 4 +- app/src/Apikey/ApikeyController.php | 5 +- app/src/Apikey/ApikeyDeleteFormType.php | 4 +- app/src/Apikey/ApikeyEntity.php | 4 +- app/src/Application/ApplicationController.php | 11 +-- app/src/Application/BaseApi.php | 2 +- app/src/Application/BaseCommentEntity.php | 4 +- .../BaseCommentReportingEntity.php | 3 +- app/src/Application/BaseController.php | 2 +- app/src/Application/BaseDb.php | 4 +- app/src/Application/BaseEntity.php | 2 +- app/src/Application/CacheService.php | 2 +- app/src/Application/Config.php | 2 +- app/src/Application/ContactApi.php | 4 +- app/src/Application/ContactFormType.php | 6 +- app/src/Client/ClientApi.php | 6 +- app/src/Client/ClientController.php | 4 +- app/src/Client/ClientDeleteFormType.php | 4 +- app/src/Client/ClientEntity.php | 4 +- app/src/Client/ClientFormType.php | 4 +- app/src/Event/Constraint/ValidEventIcon.php | 2 +- .../Constraint/ValidEventIconValidator.php | 2 +- app/src/Event/EventApi.php | 12 +-- app/src/Event/EventCommentEntity.php | 4 +- app/src/Event/EventCommentReportEntity.php | 4 +- app/src/Event/EventController.php | 24 +++--- app/src/Event/EventDb.php | 6 +- app/src/Event/EventEntity.php | 4 +- app/src/Event/EventFormType.php | 9 +- app/src/Event/EventScheduler.php | 4 +- app/src/Event/EventSchedulerDay.php | 2 +- app/src/Event/TrackApi.php | 4 +- app/src/Event/TrackCollectionFormType.php | 2 +- app/src/Event/TrackFormType.php | 2 +- .../Form/DataTransformer/DateTransformer.php | 2 +- .../DataTransformer/EventTagsTransformer.php | 2 +- app/src/Language/LanguageApi.php | 4 +- app/src/Middleware/FormMiddleware.php | 2 +- app/src/Middleware/ValidationMiddleware.php | 2 +- app/src/Search/SearchController.php | 18 ++-- app/src/Talk/SpeakerFormType.php | 4 +- app/src/Talk/TalkApi.php | 7 +- app/src/Talk/TalkCommentEntity.php | 4 +- app/src/Talk/TalkCommentReportEntity.php | 4 +- app/src/Talk/TalkController.php | 22 ++--- app/src/Talk/TalkDb.php | 6 +- app/src/Talk/TalkDeleteFormType.php | 4 +- app/src/Talk/TalkEntity.php | 4 +- app/src/Talk/TalkFormType.php | 5 +- app/src/Talk/TalkMediaFormType.php | 3 +- app/src/Talk/TalkTypeApi.php | 4 +- app/src/User/AuthApi.php | 4 +- app/src/User/EmailInputFormType.php | 2 +- app/src/User/NewPasswordFormType.php | 2 +- app/src/User/RegisterFormType.php | 2 +- app/src/User/UserApi.php | 5 +- app/src/User/UserController.php | 21 ++--- app/src/User/UserDb.php | 6 +- app/src/User/UserEntity.php | 4 +- app/src/User/UserFormType.php | 2 +- app/src/User/UsernameInputFormType.php | 2 +- app/src/View/FiltersExtension.php | 2 +- app/src/View/FunctionsExtension.php | 2 +- composer.json | 17 ++-- tests/Event/EventApiTest.php | 42 ++++----- tests/Event/EventCommentEntityTest.php | 4 +- tests/Event/EventEntityTest.php | 4 +- tests/Talk/TalkCommentEntityTest.php | 4 +- tests/View/TwigExtensionIntegrationsTest.php | 6 +- web/index.php | 86 +++++++++---------- 70 files changed, 240 insertions(+), 236 deletions(-) diff --git a/app/src/Apikey/ApikeyApi.php b/app/src/Apikey/ApikeyApi.php index 9dbd9ddc6..ebdf03b8a 100644 --- a/app/src/Apikey/ApikeyApi.php +++ b/app/src/Apikey/ApikeyApi.php @@ -1,7 +1,7 @@ getTalkDb(); $slugs = array(); - /** @var \Talk\TalkCommentEntity $comment */ + /** @var \JoindIn\Web\Talk\TalkCommentEntity $comment */ foreach ($comments as $comment) { $slugs[$comment->getTalkUri()] = $talkDb->getSlugFor($comment->getTalkUri()); } @@ -1198,7 +1198,7 @@ private function getTalkSlugsFromApi(EventEntity $event) array('resultsperpage' => 100) // Make sure we get all talks with a single request ); - /** @var \Talk\TalkEntity $talk */ + /** @var \JoindIn\Web\Talk\TalkEntity $talk */ foreach ($talks['talks'] as $talk) { $slugs[$talk->getApiUri()] = $talk->getUrlFriendlyTalkTitle(); } diff --git a/app/src/Event/EventDb.php b/app/src/Event/EventDb.php index 8675ab98e..d09630299 100644 --- a/app/src/Event/EventDb.php +++ b/app/src/Event/EventDb.php @@ -1,8 +1,8 @@ [ 'class'=>'file', ], - 'constraints' => [new Constraint\ValidEventIcon(['groupname' => 'event', 'keyname'=>'new_icon'])], + 'constraints' => [new \JoindIn\Web\Event\Constraint\ValidEventIcon(['groupname' => 'event', 'keyname' =>'new_icon'])], ] ) ; diff --git a/app/src/Event/EventScheduler.php b/app/src/Event/EventScheduler.php index 3afd2d706..f12236855 100644 --- a/app/src/Event/EventScheduler.php +++ b/app/src/Event/EventScheduler.php @@ -1,7 +1,7 @@ get('/user/logout', array($this, 'logout'))->name('user-logout'); $app->map('/user/login', array($this, 'login'))->via('GET', 'POST')->name('user-login'); diff --git a/app/src/User/UserDb.php b/app/src/User/UserDb.php index 5b20a0d8a..600179709 100644 --- a/app/src/User/UserDb.php +++ b/app/src/User/UserDb.php @@ -1,8 +1,8 @@ mockPredisClient = $this->getMockBuilder(Client::class) ->getMock(); - $this->mockCache = $this->getMockBuilder('Application\CacheService') + $this->mockCache = $this->getMockBuilder('JoindIn\Web\Application\CacheService') ->setConstructorArgs(array($this->mockPredisClient)) ->getMock(); - $this->mockDbEvent = $this->getMockBuilder('Event\EventDb') + $this->mockDbEvent = $this->getMockBuilder('JoindIn\Web\Event\EventDb') ->setConstructorArgs(array($this->mockCache)) ->getMock(); - $this->mockUserDb = $this->getMockBuilder('User\UserDb') + $this->mockUserDb = $this->getMockBuilder('JoindIn\Web\User\UserDb') ->setConstructorArgs(array($this->mockCache)) ->getMock(); - $this->mockUserApi = $this->getMockBuilder('User\UserApi') + $this->mockUserApi = $this->getMockBuilder('JoindIn\Web\User\UserApi') ->setConstructorArgs(array($this->mockConfig, null, $this->mockUserDb)) ->getMock(); } public function testDefaultgetEventsParametersAreSet() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock() @@ -55,7 +55,7 @@ public function testDefaultgetEventsParametersAreSet() public function testgetEventsWithLimitSetsParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -71,7 +71,7 @@ public function testgetEventsWithLimitSetsParamsCorrectly() public function testgetEventsWithPageValueSetsParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -87,7 +87,7 @@ public function testgetEventsWithPageValueSetsParamsCorrectly() public function testgetEventsWithFilterSetsAllParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -103,7 +103,7 @@ public function testgetEventsWithFilterSetsAllParamsCorrectly() public function testgetEventsWithVerboseSetsAllParamsCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -119,7 +119,7 @@ public function testgetEventsWithVerboseSetsAllParamsCorrectly() public function testgetEventsWithQueryParamsPassesThemThroughCorrectly() { - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -140,7 +140,7 @@ public function testAddCommentPostsAComment() { // The object containing the event details (in this case, we only // need to mock the comments_uri and its getter - $mockEventObj = $this->getMockBuilder('Event\EventEntity') + $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') ->setMethods(array('getCommentsUri')) ->setConstructorArgs(array( (object) array('comments_uri'=>'http://example.com/comments/123') @@ -155,7 +155,7 @@ public function testAddCommentPostsAComment() // We need to create the Event API class, and mock the call to the // joind.in API to return a known result and check we're making the // correct call - $mockEventApi = $this->getMockBuilder('Event\EventApi') + $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiPost')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -184,7 +184,7 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus() { // The object containing the event details (in this case, we only // need to mock the comments_uri and its getter - $mockEventObj = $this->getMockBuilder('Event\EventEntity') + $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') ->setMethods(array('getCommentsUri')) ->setConstructorArgs(array( (object) array('comments_uri'=>'http://example.com/comments/123') @@ -199,7 +199,7 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus() // We need to create the Event API class, and mock the call to the // joind.in API to return a known (failed) result and check we're making the // correct call - $mockEventApi = $this->getMockBuilder('Event\EventApi') + $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiPost')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -222,7 +222,7 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus() public function testAttendThrowsExceptionIfAPIReturnsBadStatus() { - $mockEventObj = $this->getMockBuilder('Event\EventEntity') + $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') ->setMethods(array('getApiUriToMarkAsAttending')) ->setConstructorArgs(array( (object) array('attending_uri'=>'http://example.com/events/1/attending') @@ -234,7 +234,7 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus() ->will($this->returnValue('http://example.com/events/1/attending')); - $mockEventApi = $this->getMockBuilder('Event\EventApi') + $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiPost')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -253,7 +253,7 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus() public function testDefaultGetTalkCommentsParametersAreSet() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -269,7 +269,7 @@ public function testDefaultGetTalkCommentsParametersAreSet() public function testGetTalkCommentsWithLimitSetsParamsCorrectly() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -285,7 +285,7 @@ public function testGetTalkCommentsWithLimitSetsParamsCorrectly() public function testGetTalkCommentsWithStartValueSetsParamsCorrectly() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); @@ -301,7 +301,7 @@ public function testGetTalkCommentsWithStartValueSetsParamsCorrectly() public function testGetTalkCommentsWithVerboseSetsAllParamsCorrectly() { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(array('apiGet')) ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) ->getMock(); diff --git a/tests/Event/EventCommentEntityTest.php b/tests/Event/EventCommentEntityTest.php index e3a61a4e0..3647cb591 100644 --- a/tests/Event/EventCommentEntityTest.php +++ b/tests/Event/EventCommentEntityTest.php @@ -1,7 +1,7 @@ view()->parserDirectory = realpath(__DIR__ . '/../vendor/Twig/lib/Twig'); $app->view()->setTemplatesDirectory('../app/templates'); -$app->view()->getEnvironment()->addExtension(new \View\FiltersExtension()); +$app->view()->getEnvironment()->addExtension(new \JoindIn\Web\View\FiltersExtension()); $app->view()->getEnvironment()->addExtension(new \Slim\Views\TwigExtension()); -$app->view()->getEnvironment()->addExtension(new \View\FunctionsExtension($app)); +$app->view()->getEnvironment()->addExtension(new \JoindIn\Web\View\FunctionsExtension($app)); if (isset($config['slim']['twig']['cache'])) { $app->view()->getEnvironment()->setCache($config['slim']['twig']['cache']); @@ -89,18 +89,18 @@ }); // register middlewares -$app->add(new Middleware\ValidationMiddleware()); +$app->add(new \JoindIn\Web\Middleware\ValidationMiddleware()); $csrfSecret = null; if (!empty($config['slim']['custom']['csrfSecret'])) { $csrfSecret = $config['slim']['custom']['csrfSecret']; } -$app->add(new Middleware\FormMiddleware($csrfSecret)); +$app->add(new \JoindIn\Web\Middleware\FormMiddleware($csrfSecret)); // register services $app->container->set('access_token', isset($_SESSION['access_token']) ? $_SESSION['access_token'] : null); -$app->container->singleton(\Application\CacheService::class, function ($container) { +$app->container->singleton(\JoindIn\Web\Application\CacheService::class, function ($container) { $redisServer = null; if ($host = getenv('REDIS_HOST')) { $redisServer = "tcp://$host:6379"; @@ -108,67 +108,67 @@ $client = new Predis\Client($redisServer); $keyPrefix = $container->settings['custom']['redisKeyPrefix']; - return new \Application\CacheService($client, $keyPrefix); + return new \JoindIn\Web\Application\CacheService($client, $keyPrefix); }); -$app->container->singleton(\Application\ContactApi::class, function ($container) { - return new \Application\ContactApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Application\ContactApi::class, function ($container) { + return new \JoindIn\Web\Application\ContactApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\User\UserDb::class, function ($container) { - return new \User\UserDb($container[\Application\CacheService::class]); +$app->container->singleton(\JoindIn\Web\User\UserDb::class, function ($container) { + return new \JoindIn\Web\User\UserDb($container[\JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\User\UserApi::class, function ($container) { - return new \User\UserApi( +$app->container->singleton(\JoindIn\Web\User\UserApi::class, function ($container) { + return new \JoindIn\Web\User\UserApi( $container['settings']['custom'], $container['access_token'], - $container[\User\UserDb::class] + $container[\JoindIn\Web\User\UserDb::class] ); }); -$app->container->singleton(\Event\EventDb::class, function ($container) { - return new \Event\EventDb($container[\Application\CacheService::class]); +$app->container->singleton(\JoindIn\Web\Event\EventDb::class, function ($container) { + return new \JoindIn\Web\Event\EventDb($container[\JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\Event\EventApi::class, function ($container) { - return new \Event\EventApi( +$app->container->singleton(\JoindIn\Web\Event\EventApi::class, function ($container) { + return new \JoindIn\Web\Event\EventApi( $container['settings']['custom'], $container['access_token'], - $container[\Event\EventDb::class], - $container[\User\UserApi::class] + $container[\JoindIn\Web\Event\EventDb::class], + $container[\JoindIn\Web\User\UserApi::class] ); }); -$app->container->singleton(\Talk\TalkDb::class, function ($container) { - return new \Talk\TalkDb($container[\Application\CacheService::class]); +$app->container->singleton(\JoindIn\Web\Talk\TalkDb::class, function ($container) { + return new \JoindIn\Web\Talk\TalkDb($container[\JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\Talk\TalkApi::class, function ($container) { - return new \Talk\TalkApi( +$app->container->singleton(\JoindIn\Web\Talk\TalkApi::class, function ($container) { + return new \JoindIn\Web\Talk\TalkApi( $container['settings']['custom'], $container['access_token'], - new \Talk\TalkDb($container[\Application\CacheService::class]), - $container[\User\UserApi::class] + new \JoindIn\Web\Talk\TalkDb($container[\JoindIn\Web\Application\CacheService::class]), + $container[\JoindIn\Web\User\UserApi::class] ); }); -$app->container->singleton(\User\AuthApi::class, function ($container) { - return new \User\AuthApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\User\AuthApi::class, function ($container) { + return new \JoindIn\Web\User\AuthApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Language\LanguageApi::class, function ($container) { - return new \Language\LanguageApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Language\LanguageApi::class, function ($container) { + return new \JoindIn\Web\Language\LanguageApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Talk\TalkTypeApi::class, function ($container) { - return new \Talk\TalkTypeApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Talk\TalkTypeApi::class, function ($container) { + return new \JoindIn\Web\Talk\TalkTypeApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Event\TrackApi::class, function ($container) { - return new \Event\TrackApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Event\TrackApi::class, function ($container) { + return new \JoindIn\Web\Event\TrackApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\Client\ClientApi::class, function ($container) { - return new \Client\ClientApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(\JoindIn\Web\Client\ClientApi::class, function ($container) { + return new \JoindIn\Web\Client\ClientApi($container['settings']['custom'], $container['access_token']); }); // register routes -new Application\ApplicationController($app); -new Event\EventController($app); -new Search\SearchController($app); -new User\UserController($app); -new Talk\TalkController($app); -new Client\ClientController($app); -new Apikey\ApikeyController($app); +new \JoindIn\Web\Application\ApplicationController($app); +new \JoindIn\Web\Event\EventController($app); +new \JoindIn\Web\Search\SearchController($app); +new \JoindIn\Web\User\UserController($app); +new \JoindIn\Web\Talk\TalkController($app); +new \JoindIn\Web\Client\ClientController($app); +new \JoindIn\Web\Apikey\ApikeyController($app); // execute application $app->run(); From 245c331403b6d0096d1e68f62f456ff6fb82d6a0 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 08:28:02 +0100 Subject: [PATCH 09/56] move tests/phpunit.xml to phpunit.xml.dist --- build.sh | 2 +- build.xml | 2 +- phpunit.xml.dist | 28 ++++++++++++++++++++++++++++ tests/phpunit.xml | 19 ------------------- 4 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 phpunit.xml.dist delete mode 100644 tests/phpunit.xml diff --git a/build.sh b/build.sh index c89b9b5d0..876691cc3 100755 --- a/build.sh +++ b/build.sh @@ -13,4 +13,4 @@ vendor/bin/phpcs \ php vendor/bin/security-checker security:check composer.lock -vendor/bin/phpunit -c tests/phpunit.xml \ No newline at end of file +vendor/bin/phpunit diff --git a/build.xml b/build.xml index a3e757298..e131b41dc 100644 --- a/build.xml +++ b/build.xml @@ -32,7 +32,7 @@ - + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..2a7f4df18 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + tests/ + + + + + + + + + + + app + + + diff --git a/tests/phpunit.xml b/tests/phpunit.xml deleted file mode 100644 index 22b874317..000000000 --- a/tests/phpunit.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - . - - - - - - - - - - - ../app - - - From cda8b0f3e79db8cd3f3e2f4a2d1d6de749a5b24a Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 09:00:43 +0100 Subject: [PATCH 10/56] fix references --- app/src/User/UserController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index a8c91f60d..ab43ce715 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -2,16 +2,15 @@ namespace JoindIn\Web\User; use JoindIn\Web\Application\BaseController; -use JoindIn\Web\Application\CacheService; use Symfony\Component\Form\FormError; use Slim\Slim; use JoindIn\Web\Talk\TalkDb; use JoindIn\Web\Talk\TalkApi; use JoindIn\Web\Event\EventDb; use JoindIn\Web\Event\EventApi; -use Symfony\Component\Form\Form; use Symfony\Component\Form\FormFactoryInterface; -use stdclass; +use stdClass; +use Symfony\Component\Form\FormInterface; class UserController extends BaseController { @@ -859,8 +858,8 @@ public function accessTokenFromFacebook() * Process a user login result. If result is false, then we failed, otherwise * update the session. * - * @param \stdClass|false $result - * @param string $redirect + * @param stdClass|false $result + * @param string $redirect * @return void */ protected function handleLogin($result, $redirect = '') From af0a17621d2b7eb4167cff76b4625599c374881b Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 09:02:18 +0100 Subject: [PATCH 11/56] fix deprecations and remove unneeded/invalid parameters on the ConstraintValidatorFactory --- app/src/Middleware/ValidationMiddleware.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/Middleware/ValidationMiddleware.php b/app/src/Middleware/ValidationMiddleware.php index b5f179da5..0bdc93153 100644 --- a/app/src/Middleware/ValidationMiddleware.php +++ b/app/src/Middleware/ValidationMiddleware.php @@ -9,9 +9,11 @@ use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\ConstraintValidatorFactory; use Symfony\Component\Validator\Mapping\ClassMetadataFactory; +use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\ValidatorInterface; /** * In this middleware we create the validation services as provided by Symfony and register it as service in the @@ -74,15 +76,14 @@ function () use ($middleware) { * * @see self::call() where this method is used to construct a shared instance in Slim. * - * @return Validator + * @return ValidatorInterface */ public function createValidator() { $validator = Validation::createValidatorBuilder() - ->setMetadataFactory(new ClassMetadataFactory(new StaticMethodLoader())) - ->setConstraintValidatorFactory(new ConstraintValidatorFactory($this->app, array())) + ->setMetadataFactory(new LazyLoadingMetadataFactory(new StaticMethodLoader())) + ->setConstraintValidatorFactory(new ConstraintValidatorFactory()) ->setTranslator($this->getTranslator()) - ->setApiVersion(Validation::API_VERSION_2_5) ->getValidator(); return $validator; From 2950b92be229e5f19cd656be46dc92c635ee0428 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 09:02:53 +0100 Subject: [PATCH 12/56] adds .idea to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ea32386c1..9647fffe3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea build/ web/css/site.css web/js/site.js @@ -5,4 +6,4 @@ vendor/.git node_modules/ .DS_Store web/inc -vendor/ \ No newline at end of file +vendor/ From 73c9767675022e63e207fc2d41afeebafd4809a8 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 21:40:45 +0100 Subject: [PATCH 13/56] fix deprecated DefaultCsrfProvider --- app/src/Middleware/FormMiddleware.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index ecabf326c..94110aab0 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -14,6 +14,9 @@ use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\Forms; use Symfony\Component\Form\ResolvedFormTypeFactory; +use Symfony\Component\Security\Csrf\CsrfTokenManager; +use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator; +use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage; use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\Loader\XliffFileLoader; use Symfony\Component\Translation\MessageSelector; @@ -106,8 +109,15 @@ function () use ($formMiddleWare, $csrfSecret) { */ public function createFormFactory($csrfSecret) { + $builder = Forms::createFormFactoryBuilder() - ->addExtension(new CsrfExtension(new DefaultCsrfProvider($csrfSecret))) + ->addExtension( + new CsrfExtension( + new CsrfTokenManager( + new UriSafeTokenGenerator(), new NativeSessionTokenStorage() + ) + ) + ) ->setResolvedTypeFactory(new ResolvedFormTypeFactory()); if ($this->app->validator) { From 742aca39f43ce28b8d7b10031c1b3ca275646502 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 11 Feb 2019 23:54:52 +0100 Subject: [PATCH 14/56] remove unused references --- app/src/Middleware/FormMiddleware.php | 1 - app/src/Middleware/ValidationMiddleware.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 94110aab0..979706ebe 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -8,7 +8,6 @@ use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; -use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; use Symfony\Component\Form\FormFactoryBuilder; use Symfony\Component\Form\FormFactoryInterface; diff --git a/app/src/Middleware/ValidationMiddleware.php b/app/src/Middleware/ValidationMiddleware.php index 0bdc93153..ce2ca8322 100644 --- a/app/src/Middleware/ValidationMiddleware.php +++ b/app/src/Middleware/ValidationMiddleware.php @@ -8,10 +8,8 @@ use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\ConstraintValidatorFactory; -use Symfony\Component\Validator\Mapping\ClassMetadataFactory; use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; -use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\ValidatorInterface; From 1f73eaafa09efaff8fc497e2d7133df68975229f Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Fri, 15 Feb 2019 20:21:55 +0100 Subject: [PATCH 15/56] fixes cs issue --- app/src/Middleware/FormMiddleware.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 979706ebe..8d87398c3 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -113,7 +113,8 @@ public function createFormFactory($csrfSecret) ->addExtension( new CsrfExtension( new CsrfTokenManager( - new UriSafeTokenGenerator(), new NativeSessionTokenStorage() + new UriSafeTokenGenerator(), + new NativeSessionTokenStorage() ) ) ) From 5f802fb655aecf1b49dcd9d977d7235a2e346675 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Fri, 22 Feb 2019 23:46:25 +0100 Subject: [PATCH 16/56] symplify fqcn --- app/src/Event/EventFormType.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index 7c13ee6ad..e0f848df0 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\Event; use Event\Constraint; +use JoindIn\Web\Event\Constraint\ValidEventIcon; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -176,7 +177,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'attr'=> [ 'class'=>'file', ], - 'constraints' => [new \JoindIn\Web\Event\Constraint\ValidEventIcon(['groupname' => 'event', 'keyname' =>'new_icon'])], + 'constraints' => [new ValidEventIcon(['groupname' => 'event', 'keyname' =>'new_icon'])], ] ) ; From 6b0a0573746f1eb7864f0f3274153f3318367686 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Fri, 22 Feb 2019 23:47:08 +0100 Subject: [PATCH 17/56] add test for EventFormType --- tests/Event/EventFormTypeTest.php | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/Event/EventFormTypeTest.php diff --git a/tests/Event/EventFormTypeTest.php b/tests/Event/EventFormTypeTest.php new file mode 100644 index 000000000..83b984577 --- /dev/null +++ b/tests/Event/EventFormTypeTest.php @@ -0,0 +1,68 @@ +validator = $this->createMock(ValidatorInterface::class); + $this->validator + ->method('validate') + ->will($this->returnValue(new ConstraintViolationList())); + $this->validator + ->method('getMetadataFor') + ->will($this->returnValue(new ClassMetadata(Form::class))); + + return [ + new ValidatorExtension($this->validator), + ]; + } + + public function testSubmitValidData() + { + $formData = [ + "name" => "Community Conference", + "description" => "Conference description.", + "tags" => ["php","conference","web"], + "tz_continent" => "Europe", + "tz_place" => "Amsterdam", + "start_date" => "2019-01-01", + "end_date" => "2019-01-02", + "href" => "https://example.com/2019", + "cfp_start_date" => "2019-01-03", + "cfp_end_date" => "2019-01-01", + "cfp_url" => "https://example.com/cfp", + "location" => "Location", + "latitude" => "52.3546273", + "longitude" => "4.8284121", + "new_icon" => null + ]; + + $form = $this->factory->create(EventFormType::class); + + $form->submit($formData); + + $this->assertTrue($form->isSynchronized()); + + $this->assertEquals($formData, $form->getData()); + + $view = $form->createView(); + $children = $view->children; + + foreach (array_keys($formData) as $key) { + $this->assertArrayHasKey($key, $children); + } + } +} From 2ee8fd0f044da82fe81633f2142ad6bdee9bc15b Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 3 Mar 2019 22:19:26 +0100 Subject: [PATCH 18/56] remove unneeded csrf secret --- app/src/Middleware/FormMiddleware.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 8d87398c3..849e49769 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -87,7 +87,7 @@ public function call() $this->app->container->singleton( self::SERVICE_FORM_FACTORY, function () use ($formMiddleWare, $csrfSecret) { - return $formMiddleWare->createFormFactory($csrfSecret); + return $formMiddleWare->createFormFactory(); } ); @@ -100,13 +100,11 @@ function () use ($formMiddleWare, $csrfSecret) { * Generally this method does not need to be called directly; it is used in a callback that created a shared * instance in the container of Slim. * - * @param string $csrfSecret - * * @see self::call() where this method is used to construct a shared instance in Slim. * * @return FormFactoryInterface */ - public function createFormFactory($csrfSecret) + public function createFormFactory() { $builder = Forms::createFormFactoryBuilder() From ab0d8a8604bcde69654fd418187fc5c85aa1122b Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 3 Mar 2019 22:37:00 +0100 Subject: [PATCH 19/56] add tests for middlewares --- tests/Middleware/FormMiddlewareTest.php | 42 +++++++++++++++++++ tests/Middleware/ValidationMiddlewareTest.php | 27 ++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/Middleware/FormMiddlewareTest.php create mode 100644 tests/Middleware/ValidationMiddlewareTest.php diff --git a/tests/Middleware/FormMiddlewareTest.php b/tests/Middleware/FormMiddlewareTest.php new file mode 100644 index 000000000..c169a2b7f --- /dev/null +++ b/tests/Middleware/FormMiddlewareTest.php @@ -0,0 +1,42 @@ +createMock(Slim::class); + + $validator = $this->createMock(ValidatorInterface::class); + $app->validator = $validator; + + $translator = $this->getMockBuilder(Translator::class) + ->disableOriginalConstructor() + ->getMock(); + +// $translator +// ->expects($this->once()) +// ->method('addResource'); + + $app->translator = $translator; + + $formMiddleware->setApplication($app); + + $formFactory = $formMiddleware->createFormFactory(); + + $this->assertInstanceOf(FormFactoryInterface::class, $formFactory); + } +} diff --git a/tests/Middleware/ValidationMiddlewareTest.php b/tests/Middleware/ValidationMiddlewareTest.php new file mode 100644 index 000000000..2b4de9e99 --- /dev/null +++ b/tests/Middleware/ValidationMiddlewareTest.php @@ -0,0 +1,27 @@ +setApplication($app); + + $validator = $validationMiddleware->createValidator(); + + $this->assertInstanceOf(ValidatorInterface::class, $validator); + } +} From 54487150b424f1705898f0cbb632804d2983c8c0 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 4 Mar 2019 18:48:45 +0100 Subject: [PATCH 20/56] add qa scripts to composer --- composer.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/composer.json b/composer.json index e1ef3b17b..5274104f6 100644 --- a/composer.json +++ b/composer.json @@ -35,5 +35,23 @@ "jakub-onderka/php-parallel-lint": "^1.0", "roave/security-advisories": "dev-master", "sensiolabs/security-checker": "^5.0" + }, + "scripts": { + "test": "phpunit -c . tests/", + "lint": "parallel-lint --exclude vendor .", + "sniff": "phpcs --standard=PSR2 --ignore=**/config.php,vendor,tools,tests/bootstrap.php --extensions=php --report-checkstyle=build/logs/checkstyle.xml --runtime-set ignore_warnings_on_exit true -p .", + "security": "security-checker security:check composer.lock", + "coverage": [ + "git diff origin/master... -- > diff.txt", + "diffFilter --phpunit diff.txt build/logs/clover.xml 80" + ], + "check": [ + "mkdir -p build/logs", + "@lint", + "@sniff", + "@security", + "@test", + "@coverage" + ] } } From e4926a5b2c2d3c2108a0eacdc31e699106046c85 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 6 Mar 2019 22:52:56 +0100 Subject: [PATCH 21/56] cleanup test --- tests/Middleware/FormMiddlewareTest.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/Middleware/FormMiddlewareTest.php b/tests/Middleware/FormMiddlewareTest.php index c169a2b7f..2884065c9 100644 --- a/tests/Middleware/FormMiddlewareTest.php +++ b/tests/Middleware/FormMiddlewareTest.php @@ -6,7 +6,6 @@ use Slim\Slim; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; class FormMiddlewareTest extends TestCase @@ -27,10 +26,6 @@ public function formFactoryIsCreatedCorrectly() ->disableOriginalConstructor() ->getMock(); -// $translator -// ->expects($this->once()) -// ->method('addResource'); - $app->translator = $translator; $formMiddleware->setApplication($app); From 93fa1d2108512d1b4f6819203cbdc3f56587c3a3 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 6 Mar 2019 22:53:25 +0100 Subject: [PATCH 22/56] use namespaced twig classes --- app/src/View/FiltersExtension.php | 21 ++++++++++--------- app/src/View/FunctionsExtension.php | 32 ++++++++++++++--------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/app/src/View/FiltersExtension.php b/app/src/View/FiltersExtension.php index 9015b3fb8..cb3cc5cb1 100644 --- a/app/src/View/FiltersExtension.php +++ b/app/src/View/FiltersExtension.php @@ -2,25 +2,26 @@ namespace JoindIn\Web\View; -use Twig_Environment; -use Twig_SimpleFilter; +use Twig\Environment; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; -final class FiltersExtension extends \Twig_Extension +final class FiltersExtension extends AbstractExtension { public function getFilters() { return [ - new Twig_SimpleFilter( + new TwigFilter( 'img_path', [$this, 'imgPath'], ['needs_environment' => true] ), - new Twig_SimpleFilter( + new TwigFilter( 'link', [$this, 'link'], ['is_safe' => ['html']] ), - new Twig_SimpleFilter( + new TwigFilter( 'format_date', [$this, 'formatDate'] ) @@ -28,14 +29,14 @@ public function getFilters() } /** - * @param Twig_Environment $env - * @param string $suffix - * @param string $infix + * @param Environment $env + * @param string $suffix + * @param string $infix * * @return string * @throws \Twig_Error_Runtime */ - public function imgPath(Twig_Environment $env, $suffix, $infix) + public function imgPath(Environment $env, $suffix, $infix) { if (!$suffix && $infix = 'event_icons') { $suffix = 'none.png'; diff --git a/app/src/View/FunctionsExtension.php b/app/src/View/FunctionsExtension.php index 6638590c7..1817a01ad 100644 --- a/app/src/View/FunctionsExtension.php +++ b/app/src/View/FunctionsExtension.php @@ -2,11 +2,11 @@ namespace JoindIn\Web\View; -use Twig_Extension; -use Twig_SimpleFunction; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; use Slim\Slim; -final class FunctionsExtension extends Twig_Extension +final class FunctionsExtension extends AbstractExtension { /** * @var Slim @@ -29,17 +29,17 @@ public function getFunctions() $app = $this->app; return [ - new Twig_SimpleFunction('urlFor', function ($routeName, $params = array()) use ($app) { + new TwigFunction('urlFor', function ($routeName, $params = array()) use ($app) { $url = $app->urlFor($routeName, $params); return $url; }), - new Twig_SimpleFunction('hash', function ($value) { + new TwigFunction('hash', function ($value) { return md5($value); }), - new Twig_SimpleFunction('gravatar', function ($email_hash, $size = 40) { + new TwigFunction('gravatar', function ($email_hash, $size = 40) { $size = ((int)$size == 0) ? 20 : (int)$size; $url = 'https://secure.gravatar.com/avatar/' . $email_hash . '?d=mm&s=' . $size; @@ -50,11 +50,11 @@ public function getFunctions() return $url; }), - new Twig_SimpleFunction('getCurrentRoute', function () use ($app) { + new TwigFunction('getCurrentRoute', function () use ($app) { return $app->router->getCurrentRoute()->getName(); }), - new Twig_SimpleFunction('getCurrentUrl', function ($fullyQualified = false) use ($app) { + new TwigFunction('getCurrentUrl', function ($fullyQualified = false) use ($app) { $url = $_SERVER['REQUEST_URI']; if ($fullyQualified) { @@ -67,25 +67,25 @@ public function getFunctions() return $url; }), - new Twig_SimpleFunction('urlForTalk', function ($eventSlug, $talkSlug, $params = array()) use ($app) { + new TwigFunction('urlForTalk', function ($eventSlug, $talkSlug, $params = array()) use ($app) { return $app->urlFor('talk', array('eventSlug' => $eventSlug, 'talkSlug' => $talkSlug)); }), - new Twig_SimpleFunction('shortUrlForTalk', function ($talkStub) use ($app) { + new TwigFunction('shortUrlForTalk', function ($talkStub) use ($app) { $scheme = $app->request()->getScheme(); $host = $app->request()->headers('host'); return "$scheme://$host" . $app->urlFor('talk-quicklink', array('talkStub' => $talkStub)); }), - new Twig_SimpleFunction('shortUrlForEvent', function ($eventStub) use ($app) { + new TwigFunction('shortUrlForEvent', function ($eventStub) use ($app) { $scheme = $app->request()->getScheme(); $host = $app->request()->headers('host'); return "$scheme://$host" . $app->urlFor('event-quicklink', array('stub' => $eventStub)); }), - new Twig_SimpleFunction( + new TwigFunction( 'dateRange', function ($start, $end, $format = 'd.m.Y', $separator = ' - ') { $formatter = new \Org_Heigl\DateRange\DateRangeFormatter(); @@ -111,7 +111,7 @@ function ($start, $end, $format = 'd.m.Y', $separator = ' - ') { * - 120 minutes converts to "2 hours" * - 126 minutes converts to "2 hours, 6 minutes" */ - new Twig_SimpleFunction('prettyDuration', function ($duration) { + new TwigFunction('prettyDuration', function ($duration) { $duration = (int)$duration; if ($duration < 60) { @@ -140,7 +140,7 @@ function ($start, $end, $format = 'd.m.Y', $separator = ' - ') { /** * wrapped Slim request function getPath() */ - new Twig_SimpleFunction('currentPath', function () use ($app) { + new TwigFunction('currentPath', function () use ($app) { $request = $app->request; $params = $app->request->get(); $queryString = http_build_query($params); @@ -155,7 +155,7 @@ function ($start, $end, $format = 'd.m.Y', $separator = ' - ') { /** * Create link to log in with Facebook */ - new Twig_SimpleFunction( + new TwigFunction( 'facebookLoginUrl', function () use ($app) { if (!$app->config('facebook') || empty($app->config('facebook')['app_id'])) { @@ -182,7 +182,7 @@ function () use ($app) { /** * Create a link to download a QR-Code for the given URL */ - new Twig_SimpleFunction('qrcode', function ($url) { + new TwigFunction('qrcode', function ($url) { return sprintf( 'https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl=%s&choe=UTF-8&chld=H', urlencode($url) From fa8c8c6ebce36ef2c0d4db1965c8756adf24e240 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:10:36 +0100 Subject: [PATCH 23/56] remove unused use statement for constraint --- app/src/Event/EventFormType.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index e0f848df0..83bedcbf2 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -2,7 +2,6 @@ namespace JoindIn\Web\Event; -use Event\Constraint; use JoindIn\Web\Event\Constraint\ValidEventIcon; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; From 016731854997726bee35792f62f40a9ea1a4cea7 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:13:33 +0100 Subject: [PATCH 24/56] fix array type in dockblocks --- app/src/Event/EventSchedulerDay.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/Event/EventSchedulerDay.php b/app/src/Event/EventSchedulerDay.php index b282b1ba4..b574a30b6 100644 --- a/app/src/Event/EventSchedulerDay.php +++ b/app/src/Event/EventSchedulerDay.php @@ -17,21 +17,21 @@ class EventSchedulerDay private $date; /** - * @var Array $talks + * @var array */ private $talks; /** - * @var Array $tracks + * @var array */ private $tracks; /** * Constructor * - * @param $date String - * @param $talks Array Multi-dimensional associative array of talk objects - * @param $tracks Array Indexed array of track names + * @param string $date + * @param array $talks Multi-dimensional associative array of talk objects + * @param array $tracks Indexed array of track names */ public function __construct($date, $talks, $tracks) { @@ -55,7 +55,7 @@ public function getDate() /** * Get talks * - * @return Array + * @return array */ public function getTalks() { @@ -65,7 +65,7 @@ public function getTalks() /** * Get tracks * - * @return Array + * @return array */ public function getTracks() { From db63b27b33d4eca77caecb8692409e3ad31c1356 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:22:00 +0100 Subject: [PATCH 25/56] add typehints to docblocks --- app/src/Event/EventScheduler.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/Event/EventScheduler.php b/app/src/Event/EventScheduler.php index f12236855..e40bfb293 100644 --- a/app/src/Event/EventScheduler.php +++ b/app/src/Event/EventScheduler.php @@ -2,6 +2,7 @@ namespace JoindIn\Web\Event; use JoindIn\Web\Talk\TalkApi; +use JoindIn\Web\Talk\TalkEntity; /** * Class EventScheduler @@ -43,7 +44,7 @@ public function getScheduleData(EventEntity $event) /** * Retrieves talk collection from API * - * @param $talks_uri + * @param string $talks_uri * @return array */ public function getTalks($talks_uri) @@ -56,7 +57,7 @@ public function getTalks($talks_uri) /** * Get an array of populated EventSchedulerDay objects * - * @param $talks + * @param TalkEntity[] $talks * @return array Array of EventSchedulerDay objects */ public function getEventDays($talks) @@ -83,7 +84,7 @@ public function getEventDays($talks) * associative array by day, then by time for each * day * - * @param $talks + * @param TalkEntity[] $talks * @return array */ protected function organiseTalksByDayAndTime($talks) @@ -112,7 +113,7 @@ protected function organiseTalksByDayAndTime($talks) * Get a multi-dimensional indexed array of unique * track names by date * - * @param $talks + * @param TalkEntity[] $talks * @return array */ protected function getTracksByDay($talks) From da8784be476d905b587634ab1d9b4fb5420e1206 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:22:35 +0100 Subject: [PATCH 26/56] add typehint --- app/src/Event/EventApi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/Event/EventApi.php b/app/src/Event/EventApi.php index 74f4b1dae..243a9358d 100644 --- a/app/src/Event/EventApi.php +++ b/app/src/Event/EventApi.php @@ -164,7 +164,7 @@ public function getComments($comment_uri, $verbose = false) return $commentData; } - public function addComment($event, $comment, $rating = 0) + public function addComment(EventEntity $event, $comment, $rating = 0) { $uri = $event->getCommentsUri(); $params = array( From 84a41eacbd823e39553fc5b80b6c4b2078125064 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:23:03 +0100 Subject: [PATCH 27/56] add typehints --- app/src/Event/EventController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index 7258e5585..b950b65ef 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -972,7 +972,7 @@ public function talkClaims($friendly_name) ); } } - private function appoveClaimPendingTalk($talkApi, $claim, $data) + private function appoveClaimPendingTalk(TalkApi $talkApi, $claim, $data) { $talkApi->claimTalk($claim->approve_claim_uri, $data); @@ -982,7 +982,7 @@ private function appoveClaimPendingTalk($talkApi, $claim, $data) /** * Reject a talk claim */ - private function rejectClaimPendingTalk($talkApi, $claim, $data) + private function rejectClaimPendingTalk(TalkApi $talkApi, $claim, $data) { $talkApi->rejectTalkClaim($claim->approve_claim_uri, $data); @@ -1094,6 +1094,7 @@ public function editTracks($friendly_name) $data['tracks'][] = []; } + /** @var FormFactoryInterface $factory */ $factory = $this->application->formFactory; $form = $factory->create(new TrackCollectionFormType(), $data); From 40cbf4012fd85304682b7af25d42ea919983aad9 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:23:44 +0100 Subject: [PATCH 28/56] define continents and cities before modification --- app/src/Event/EventFormType.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index 83bedcbf2..84cc74d75 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -263,13 +263,16 @@ public function getListOfTimezoneContinentsAndCities() $timezones = \DateTimeZone::listIdentifiers(); array_pop($timezones); // Remove UTC from the end of the list + $continents = []; + $cities = []; + foreach ($timezones as $timezone) { list($continent, $city) = explode('/', $timezone, 2); $continents[$continent] = $continent; $cities[$city] = $city; } - return array($continents, $cities); + return [$continents, $cities]; } /** From 52ec28e59cd3e7871cddd04761a164ecc5895b01 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:28:59 +0100 Subject: [PATCH 29/56] update return types --- app/src/Event/EventApi.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/Event/EventApi.php b/app/src/Event/EventApi.php index 243a9358d..e84864f21 100644 --- a/app/src/Event/EventApi.php +++ b/app/src/Event/EventApi.php @@ -61,7 +61,7 @@ public function getEvents($limit = 10, $start = 1, $filter = null, $verbose = fa * and return us an event * * @param string $friendlyUrl The nice url bit of the event (e.g. phpbenelux-conference-2014) - * @return EventEntity The event we found, or false if something went wrong + * @return EventEntity|bool The event we found, or false if something went wrong */ public function getByFriendlyUrl($friendlyUrl) { @@ -80,7 +80,7 @@ public function getByFriendlyUrl($friendlyUrl) * and return us an event * * @param string $stub The short url bit of the event (e.g. phpbnl14) - * @return EventEntity The event we found, or false if something went wrong + * @return EventEntity|bool The event we found, or false if something went wrong */ public function getByStub($stub) { @@ -127,7 +127,7 @@ public function getEvent($event_uri, $verbose = true) * Get an event by id * * @param integer $eventId - * @return EventEntity + * @return EventEntity|null */ public function getEventById($eventId) { @@ -145,7 +145,7 @@ public function getEventById($eventId) * Get comments for given event * @param $comment_uri * @param bool $verbose - * @return EventCommentEntity[] + * @return array|EventCommentEntity[] */ public function getComments($comment_uri, $verbose = false) { From 71715aa95d71a63d8cbf5746fd3bac85d6d7de3f Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:29:57 +0100 Subject: [PATCH 30/56] typehint against FormInterface --- app/src/Event/EventController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index b950b65ef..a3efe089a 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -7,6 +7,7 @@ use Symfony\Component\Form\Form; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\FormInterface; use Symfony\Component\Validator\Validator; use JoindIn\Web\Talk\TalkDb; use JoindIn\Web\Talk\TalkApi; @@ -692,11 +693,11 @@ public function redirectFromId($eventId, $extra = false) * * Should an error occur will this method append an error message to the form's error collection. * - * @param Form $form + * @param FormInterface $form * * @return EventEntity|null|false */ - private function addEventUsingForm(Form $form) + private function addEventUsingForm(FormInterface $form) { $eventApi = $this->getEventApi(); $values = $form->getData(); @@ -719,11 +720,11 @@ private function addEventUsingForm(Form $form) * * Should an error occur will this method append an error message to the form's error collection. * - * @param Form $form + * @param FormInterface $form * * @return EventEntity|null|false */ - private function editEventUsingForm(Form $form) + private function editEventUsingForm(FormInterface $form) { $eventApi = $this->getEventApi(); $values = $form->getData()->toArray(); From 8653def819f70d8d5636c84c1f2984152b4cb2b2 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:30:15 +0100 Subject: [PATCH 31/56] update param typehints --- app/src/Event/EventScheduler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/Event/EventScheduler.php b/app/src/Event/EventScheduler.php index e40bfb293..159048d49 100644 --- a/app/src/Event/EventScheduler.php +++ b/app/src/Event/EventScheduler.php @@ -57,7 +57,7 @@ public function getTalks($talks_uri) /** * Get an array of populated EventSchedulerDay objects * - * @param TalkEntity[] $talks + * @param array|TalkEntity[] $talks * @return array Array of EventSchedulerDay objects */ public function getEventDays($talks) @@ -84,7 +84,7 @@ public function getEventDays($talks) * associative array by day, then by time for each * day * - * @param TalkEntity[] $talks + * @param array|TalkEntity[] $talks * @return array */ protected function organiseTalksByDayAndTime($talks) @@ -113,7 +113,7 @@ protected function organiseTalksByDayAndTime($talks) * Get a multi-dimensional indexed array of unique * track names by date * - * @param TalkEntity[] $talks + * @param array|TalkEntity[] $talks * @return array */ protected function getTracksByDay($talks) From a6868cf25d8271dc74ea0bfff8eb8e6941da780a Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:31:31 +0100 Subject: [PATCH 32/56] fix concatenation operator --- app/src/Event/EventFormType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index 84cc74d75..a32350a01 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -99,7 +99,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'choice', [ 'label' => 'Timezone', - 'choices' => array("Select a continent") + $continents, + 'choices' => array("Select a continent") & $continents, 'constraints' => [new Assert\NotBlank()], ] ) @@ -108,7 +108,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'choice', [ 'label' => 'Timezone city', - 'choices' => array('Select a city') + $cities, + 'choices' => array('Select a city') & $cities, 'constraints' => [new Assert\NotBlank()], ] ) From 66ef241b09773854a9794b750b38bd07678b0c58 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:34:24 +0100 Subject: [PATCH 33/56] add returntype --- app/src/Event/EventController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index a3efe089a..12de6f03f 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -1187,8 +1187,9 @@ private function getTalkSlugsFromDb(array $comments) } /** - * @param array $slugs * @param EventEntity $event + * + * @return array */ private function getTalkSlugsFromApi(EventEntity $event) { @@ -1200,6 +1201,7 @@ private function getTalkSlugsFromApi(EventEntity $event) array('resultsperpage' => 100) // Make sure we get all talks with a single request ); + $slugs = []; /** @var \JoindIn\Web\Talk\TalkEntity $talk */ foreach ($talks['talks'] as $talk) { $slugs[$talk->getApiUri()] = $talk->getUrlFriendlyTalkTitle(); From 5203902058087cea500d860b4658e485efa3d2ce Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 21:34:49 +0100 Subject: [PATCH 34/56] remove nonexistent parameter from docblock --- app/src/Event/TrackApi.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/Event/TrackApi.php b/app/src/Event/TrackApi.php index 96e4e468e..48948b525 100644 --- a/app/src/Event/TrackApi.php +++ b/app/src/Event/TrackApi.php @@ -91,7 +91,6 @@ public function addTrack($eventTracksUri, $data) * Delete a track * * @param string $trackUri - * @param array $data */ public function deleteTrack($trackUri) { From 9fd75165216237dcfb0ae78529943e37f855232f Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 22:34:01 +0100 Subject: [PATCH 35/56] use array_merge to merge arrays --- app/src/Event/EventFormType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index a32350a01..cec173a0f 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -99,7 +99,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'choice', [ 'label' => 'Timezone', - 'choices' => array("Select a continent") & $continents, + 'choices' => array_merge(["Select a continent"], $continents), 'constraints' => [new Assert\NotBlank()], ] ) @@ -108,7 +108,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'choice', [ 'label' => 'Timezone city', - 'choices' => array('Select a city') & $cities, + 'choices' => array_merge(['Select a city'], $cities), 'constraints' => [new Assert\NotBlank()], ] ) From f9eefbc9d6996104d5da71aa660a05d2ebc83a48 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Wed, 27 Mar 2019 22:35:13 +0100 Subject: [PATCH 36/56] revert to using phpunit 7 as symfony testcases are incompatible with phpunit 8 --- composer.json | 2 +- composer.lock | 271 ++++++++++++++++++++++++++------------------------ 2 files changed, 141 insertions(+), 132 deletions(-) diff --git a/composer.json b/composer.json index e133ed1a2..00fddee92 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "^1.0", - "phpunit/phpunit": "^8.0", + "phpunit/phpunit": "^7.0", "roave/security-advisories": "dev-master", "sensiolabs/security-checker": "^5.0", "squizlabs/php_codesniffer": "^3.4" diff --git a/composer.lock b/composer.lock index 63b5df924..80d5ea1e7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7685dcaf3216227865baecf08aeb4410", + "content-hash": "4f61645952b4ada8ee063803020d2117", "packages": [ { "name": "guzzlehttp/guzzle", @@ -321,33 +321,29 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.18", + "version": "v9.99.99", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db" + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", - "reference": "0a58ef6e3146256cc3dc7cc393927bcc7d1b72db", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": "^7" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -366,7 +362,7 @@ "pseudorandom", "random" ], - "time": "2019-01-03T20:59:08+00:00" + "time": "2018-07-02T15:55:56+00:00" }, { "name": "predis/predis", @@ -922,16 +918,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + "reference": "82ebae02209c21113908c229e9883c419720738a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", "shasum": "" }, "require": { @@ -943,7 +939,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -976,20 +972,20 @@ "polyfill", "portable" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "f22a90256d577c7ef7efad8df1f0201663d57644" + "reference": "999878a3a09d73cae157b0cf89bb6fb2cc073057" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/f22a90256d577c7ef7efad8df1f0201663d57644", - "reference": "f22a90256d577c7ef7efad8df1f0201663d57644", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/999878a3a09d73cae157b0cf89bb6fb2cc073057", + "reference": "999878a3a09d73cae157b0cf89bb6fb2cc073057", "shasum": "" }, "require": { @@ -1034,20 +1030,20 @@ "portable", "shim" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2019-01-07T19:39:47+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", - "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", "shasum": "" }, "require": { @@ -1059,7 +1055,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -1093,20 +1089,20 @@ "portable", "shim" ], - "time": "2018-09-21T13:07:52+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "symfony/polyfill-php56", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "ff208829fe1aa48ab9af356992bb7199fed551af" + "reference": "f4dddbc5c3471e1b700a147a20ae17cdb72dbe42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/ff208829fe1aa48ab9af356992bb7199fed551af", - "reference": "ff208829fe1aa48ab9af356992bb7199fed551af", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/f4dddbc5c3471e1b700a147a20ae17cdb72dbe42", + "reference": "f4dddbc5c3471e1b700a147a20ae17cdb72dbe42", "shasum": "" }, "require": { @@ -1116,7 +1112,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -1149,20 +1145,20 @@ "portable", "shim" ], - "time": "2018-09-21T06:26:08+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224" + "reference": "bc4858fb611bda58719124ca079baff854149c89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224", - "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/bc4858fb611bda58719124ca079baff854149c89", + "reference": "bc4858fb611bda58719124ca079baff854149c89", "shasum": "" }, "require": { @@ -1172,7 +1168,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -1208,20 +1204,20 @@ "portable", "shim" ], - "time": "2018-09-21T06:26:08+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "symfony/polyfill-util", - "version": "v1.10.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", - "reference": "3b58903eae668d348a7126f999b0da0f2f93611c" + "reference": "b46c6cae28a3106735323f00a0c38eccf2328897" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/3b58903eae668d348a7126f999b0da0f2f93611c", - "reference": "3b58903eae668d348a7126f999b0da0f2f93611c", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/b46c6cae28a3106735323f00a0c38eccf2328897", + "reference": "b46c6cae28a3106735323f00a0c38eccf2328897", "shasum": "" }, "require": { @@ -1230,7 +1226,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -1260,7 +1256,7 @@ "polyfill", "shim" ], - "time": "2018-09-30T16:36:12+00:00" + "time": "2019-02-08T14:16:39+00:00" }, { "name": "symfony/property-access", @@ -1324,16 +1320,16 @@ }, { "name": "symfony/security-core", - "version": "v3.4.22", + "version": "v3.4.23", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "816ba9bacc8ba5303f250597b2c9af380d9d715b" + "reference": "2ee045a2937b13a0ec50571358d52f05a5537aee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/816ba9bacc8ba5303f250597b2c9af380d9d715b", - "reference": "816ba9bacc8ba5303f250597b2c9af380d9d715b", + "url": "https://api.github.com/repos/symfony/security-core/zipball/2ee045a2937b13a0ec50571358d52f05a5537aee", + "reference": "2ee045a2937b13a0ec50571358d52f05a5537aee", "shasum": "" }, "require": { @@ -1387,7 +1383,7 @@ ], "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", - "time": "2019-01-31T10:03:47+00:00" + "time": "2019-02-23T15:06:07+00:00" }, { "name": "symfony/security-csrf", @@ -1675,16 +1671,16 @@ }, { "name": "twig/twig", - "version": "v1.38.2", + "version": "v1.38.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "874adbd9222f928f6998732b25b01b41dff15b0c" + "reference": "7732e9e7017d751313811bd118de61302e9c8b35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/874adbd9222f928f6998732b25b01b41dff15b0c", - "reference": "874adbd9222f928f6998732b25b01b41dff15b0c", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/7732e9e7017d751313811bd118de61302e9c8b35", + "reference": "7732e9e7017d751313811bd118de61302e9c8b35", "shasum": "" }, "require": { @@ -1737,7 +1733,7 @@ "keywords": [ "templating" ], - "time": "2019-03-12T18:45:24+00:00" + "time": "2019-03-23T14:27:19+00:00" } ], "packages-dev": [ @@ -1799,27 +1795,29 @@ }, { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -1844,12 +1842,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "jakub-onderka/php-parallel-lint", @@ -2266,40 +2264,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.3", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0317a769a81845c390e19684d9ba25d7f6aa4707", - "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0.1", + "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.6.1" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -2325,7 +2323,7 @@ "testing", "xunit" ], - "time": "2019-02-26T07:38:26+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2518,16 +2516,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.0.5", + "version": "7.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "19cbed2120839772c4a00e8b28456b0c77d1a7b4" + "reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/19cbed2120839772c4a00e8b28456b0c77d1a7b4", - "reference": "19cbed2120839772c4a00e8b28456b0c77d1a7b4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c29c0525cf4572c11efe1db49a8b8aee9dfac58a", + "reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a", "shasum": "" }, "require": { @@ -2537,25 +2535,27 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.7", "phar-io/manifest": "^1.0.2", "phar-io/version": "^2.0", - "php": "^7.2", + "php": "^7.1", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^7.0", + "phpunit/php-code-coverage": "^6.0.7", "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^2.1", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^4.1", + "sebastian/environment": "^4.0", "sebastian/exporter": "^3.1", - "sebastian/global-state": "^3.0", + "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, "require-dev": { "ext-pdo": "*" }, @@ -2570,7 +2570,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.0-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -2596,7 +2596,7 @@ "testing", "xunit" ], - "time": "2019-03-16T07:33:46+00:00" + "time": "2019-03-26T13:23:54+00:00" }, { "name": "roave/security-advisories", @@ -3089,26 +3089,23 @@ }, { "name": "sebastian/global-state", - "version": "3.0.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.0" }, "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -3116,7 +3113,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -3139,7 +3136,7 @@ "keywords": [ "global state" ], - "time": "2019-02-01T05:30:01+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", @@ -3470,21 +3467,21 @@ }, { "name": "symfony/console", - "version": "v3.4.22", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be" + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/069bf3f0e8f871a2169a06e43d9f3f03f355e9be", - "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be", + "url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9", + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", + "php": "^7.1.3", + "symfony/contracts": "^1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { @@ -3496,11 +3493,11 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", + "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "symfony/process": "~3.4|~4.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3511,7 +3508,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -3538,44 +3535,48 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-01-25T10:42:12+00:00" + "time": "2019-02-23T15:17:42+00:00" }, { - "name": "symfony/debug", - "version": "v3.4.22", + "name": "symfony/contracts", + "version": "v1.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8" + "url": "https://github.com/symfony/contracts.git", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8", - "reference": "667a26c4dd6bc75c67f06bc9bcd015bdecc7cbb8", + "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "php": "^7.1.3" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Contracts\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "**/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3584,17 +3585,25 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "A set of abstractions extracted out of the Symfony components", "homepage": "https://symfony.com", - "time": "2019-01-25T10:19:25+00:00" + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2018-12-05T08:06:11+00:00" }, { "name": "theseer/tokenizer", From e9863bf923debdbc5f53869ec6c24473112c3726 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 2 Jun 2019 23:35:59 +0200 Subject: [PATCH 37/56] run composer update --- composer.lock | 200 +++++++++++++++++++++++++++----------------------- 1 file changed, 109 insertions(+), 91 deletions(-) diff --git a/composer.lock b/composer.lock index 80d5ea1e7..c41aebe56 100644 --- a/composer.lock +++ b/composer.lock @@ -713,7 +713,7 @@ }, { "name": "symfony/form", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/form.git", @@ -864,7 +864,7 @@ }, { "name": "symfony/options-resolver", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -961,7 +961,7 @@ }, { "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "email": "BackEndTea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", @@ -1320,16 +1320,16 @@ }, { "name": "symfony/security-core", - "version": "v3.4.23", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "2ee045a2937b13a0ec50571358d52f05a5537aee" + "reference": "eebbb6e8bdeb31c32a3eaece502f89f5d5690960" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/2ee045a2937b13a0ec50571358d52f05a5537aee", - "reference": "2ee045a2937b13a0ec50571358d52f05a5537aee", + "url": "https://api.github.com/repos/symfony/security-core/zipball/eebbb6e8bdeb31c32a3eaece502f89f5d5690960", + "reference": "eebbb6e8bdeb31c32a3eaece502f89f5d5690960", "shasum": "" }, "require": { @@ -1383,11 +1383,11 @@ ], "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", - "time": "2019-02-23T15:06:07+00:00" + "time": "2019-05-05T16:11:06+00:00" }, { "name": "symfony/security-csrf", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", @@ -1512,7 +1512,7 @@ }, { "name": "symfony/twig-bridge", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", @@ -1597,7 +1597,7 @@ }, { "name": "symfony/validator", - "version": "v2.8.49", + "version": "v2.8.50", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", @@ -1671,16 +1671,16 @@ }, { "name": "twig/twig", - "version": "v1.38.4", + "version": "v1.42.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "7732e9e7017d751313811bd118de61302e9c8b35" + "reference": "2983fcf2e20a4afe95f07e61d89a7590b3c8df2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/7732e9e7017d751313811bd118de61302e9c8b35", - "reference": "7732e9e7017d751313811bd118de61302e9c8b35", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/2983fcf2e20a4afe95f07e61d89a7590b3c8df2e", + "reference": "2983fcf2e20a4afe95f07e61d89a7590b3c8df2e", "shasum": "" }, "require": { @@ -1690,12 +1690,12 @@ "require-dev": { "psr/container": "^1.0", "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + "symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.38-dev" + "dev-master": "1.42-dev" } }, "autoload": { @@ -1733,7 +1733,7 @@ "keywords": [ "templating" ], - "time": "2019-03-23T14:27:19+00:00" + "time": "2019-05-31T06:20:05+00:00" } ], "packages-dev": [ @@ -1899,16 +1899,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { @@ -1943,7 +1943,7 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "phar-io/manifest", @@ -2103,16 +2103,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", "shasum": "" }, "require": { @@ -2150,7 +2150,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2019-04-30T17:48:53+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -2516,16 +2516,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.8", + "version": "7.5.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a" + "reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c29c0525cf4572c11efe1db49a8b8aee9dfac58a", - "reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c", + "reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c", "shasum": "" }, "require": { @@ -2596,7 +2596,7 @@ "testing", "xunit" ], - "time": "2019-03-26T13:23:54+00:00" + "time": "2019-05-28T11:59:40+00:00" }, { "name": "roave/security-advisories", @@ -2604,12 +2604,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "018ec51b676a4d1efc971950d1d9619570b71676" + "reference": "4c0ba8a35f1f12dd9236452e9fae4346b0bf2a56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/018ec51b676a4d1efc971950d1d9619570b71676", - "reference": "018ec51b676a4d1efc971950d1d9619570b71676", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/4c0ba8a35f1f12dd9236452e9fae4346b0bf2a56", + "reference": "4c0ba8a35f1f12dd9236452e9fae4346b0bf2a56", "shasum": "" }, "conflict": { @@ -2623,14 +2623,14 @@ "aws/aws-sdk-php": ">=3,<3.2.1", "brightlocal/phpwhois": "<=4.2.5", "bugsnag/bugsnag-laravel": ">=2,<2.0.2", - "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.0.15|>=3.1,<3.1.4|>=3.4,<3.4.14|>=3.5,<3.5.17|>=3.6,<3.6.4", + "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.5.18|>=3.6,<3.6.15|>=3.7,<3.7.7", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", "codeigniter/framework": "<=3.0.6", - "composer/composer": "<=1.0.0-alpha11", + "composer/composer": "<=1-alpha.11", "contao-components/mediaelement": ">=2.14.2,<2.21.1", - "contao/core": ">=2,<3.5.35", - "contao/core-bundle": ">=4,<4.4.18|>=4.5,<4.5.8", + "contao/core": ">=2,<3.5.39", + "contao/core-bundle": ">=4,<4.4.39|>=4.5,<4.7.5", "contao/listing-bundle": ">=4,<4.4.8", "contao/newsletter-bundle": ">=4,<4.1", "david-garcia/phpwhois": "<=4.3.1", @@ -2644,9 +2644,9 @@ "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.64|>=8,<8.5.13|>=8.6,<8.6.12", - "drupal/drupal": ">=7,<7.64|>=8,<8.5.13|>=8.6,<8.6.12", - "erusev/parsedown": "<1.7", + "drupal/core": ">=7,<7.67|>=8,<8.6.16|>=8.7,<8.7.1", + "drupal/drupal": ">=7,<7.67|>=8,<8.6.16|>=8.7,<8.7.1", + "erusev/parsedown": "<1.7.2", "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.13.1|>=6,<6.7.9.1|>=6.8,<6.13.5.1|>=7,<7.2.4.1|>=7.3,<7.3.2.1", "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.12.3|>=2011,<2017.12.4.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", @@ -2659,7 +2659,7 @@ "fuel/core": "<1.8.1", "gree/jose": "<=2.2", "gregwar/rst": "<1.0.3", - "guzzlehttp/guzzle": ">=6,<6.2.1|>=4.0.0-rc2,<4.2.4|>=5,<5.3.1", + "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", @@ -2674,9 +2674,9 @@ "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", "league/commonmark": "<0.18.3", - "magento/magento1ce": "<1.9.4", - "magento/magento1ee": ">=1.9,<1.14.4", - "magento/product-community-edition": ">=2,<2.2.7", + "magento/magento1ce": "<1.9.4.1", + "magento/magento1ee": ">=1.9,<1.14.4.1", + "magento/product-community-edition": ">=2,<2.2.8|>=2.3,<2.3.1", "monolog/monolog": ">=1.8,<1.12", "namshi/jose": "<2.2", "onelogin/php-saml": "<2.10.4", @@ -2694,7 +2694,7 @@ "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", - "propel/propel": ">=2.0.0-alpha1,<=2.0.0-alpha7", + "propel/propel": ">=2-alpha.1,<=2-alpha.7", "propel/propel1": ">=1,<=1.7.1", "pusher/pusher-php-server": "<2.2.1", "robrichards/xmlseclibs": ">=1,<3.0.2", @@ -2708,7 +2708,7 @@ "silverstripe/userforms": "<3", "simple-updates/phpwhois": "<=1", "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", - "simplesamlphp/simplesamlphp": "<1.16.3", + "simplesamlphp/simplesamlphp": "<1.15.2|>=1.16,<1.16.3", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "slim/slim": "<2.6", "smarty/smarty": "<3.1.33", @@ -2718,39 +2718,45 @@ "stormpath/sdk": ">=0,<9.9.99", "swiftmailer/swiftmailer": ">=4,<5.4.5", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", - "sylius/sylius": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", - "symfony/dependency-injection": ">=2,<2.0.17", + "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", + "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", + "sylius/sylius": ">=1,<1.1.18|>=1.2,<1.2.17|>=1.3,<1.3.12|>=1.4,<1.4.4", + "symfony/cache": ">=3.2,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", - "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2", - "symfony/http-foundation": ">=2,<2.7.49|>=2.8,<2.8.44|>=3,<3.3.18|>=3.4,<3.4.14|>=4,<4.0.14|>=4.1,<4.1.3", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/http-foundation": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/http-kernel": ">=2,<2.3.29|>=2.4,<2.5.12|>=2.6,<2.6.8", "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/phpunit-bridge": ">=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/polyfill": ">=1,<1.10", "symfony/polyfill-php55": ">=1,<1.10", + "symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/routing": ">=2,<2.0.19", - "symfony/security": ">=2,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.19|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/security": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.37|>=3,<3.3.17|>=3.4,<3.4.7|>=4,<4.0.7", "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", - "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/serializer": ">=2,<2.0.11", - "symfony/symfony": ">=2,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", + "symfony/symfony": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/translation": ">=2,<2.0.17", "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", "tecnickcom/tcpdf": "<6.2.22", "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3", + "thelia/thelia": ">=2.1-beta.1,<2.1.3", "theonedemon/phpwhois": "<=4.2.5", "titon/framework": ">=0,<9.9.99", "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.7", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.23|>=9,<9.5.4", - "typo3/cms-core": ">=8,<8.7.23|>=9,<9.5.4", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.25|>=9,<9.5.6", + "typo3/cms-core": ">=8,<8.7.25|>=9,<9.5.6", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", + "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", "ua-parser/uap-php": "<3.8", "wallabag/tcpdf": "<6.2.22", "willdurand/js-translation-bundle": "<2.1.1", @@ -2766,6 +2772,7 @@ "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", "zendframework/zend-diactoros": ">=1,<1.8.4", "zendframework/zend-feed": ">=1,<2.10.3", "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", @@ -2800,7 +2807,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2019-03-22T05:18:50+00:00" + "time": "2019-05-23T20:42:12+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2969,16 +2976,16 @@ }, { "name": "sebastian/environment", - "version": "4.1.0", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" + "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", - "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", "shasum": "" }, "require": { @@ -2993,7 +3000,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -3018,7 +3025,7 @@ "environment", "hhvm" ], - "time": "2019-02-01T05:27:49+00:00" + "time": "2019-05-05T09:05:15+00:00" }, { "name": "sebastian/exporter", @@ -3416,16 +3423,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.4.1", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5b4333b4010625d29580eb4a41f1e53251be6baa" + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5b4333b4010625d29580eb4a41f1e53251be6baa", - "reference": "5b4333b4010625d29580eb4a41f1e53251be6baa", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", "shasum": "" }, "require": { @@ -3463,20 +3470,20 @@ "phpcs", "standards" ], - "time": "2019-03-19T03:22:27+00:00" + "time": "2019-04-10T23:49:02+00:00" }, { "name": "symfony/console", - "version": "v4.2.4", + "version": "v4.2.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9" + "reference": "7a293c9a4587a92e6a0e81edb0bea54071b1b99d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9", - "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9", + "url": "https://api.github.com/repos/symfony/console/zipball/7a293c9a4587a92e6a0e81edb0bea54071b1b99d", + "reference": "7a293c9a4587a92e6a0e81edb0bea54071b1b99d", "shasum": "" }, "require": { @@ -3535,40 +3542,51 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-02-23T15:17:42+00:00" + "time": "2019-05-09T09:19:46+00:00" }, { "name": "symfony/contracts", - "version": "v1.0.2", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/symfony/contracts.git", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + "reference": "b6e291a08e6b002fb56aa6f3e2a2beb6674d2b2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", - "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "url": "https://api.github.com/repos/symfony/contracts/zipball/b6e291a08e6b002fb56aa6f3e2a2beb6674d2b2f", + "reference": "b6e291a08e6b002fb56aa6f3e2a2beb6674d2b2f", "shasum": "" }, "require": { "php": "^7.1.3" }, + "replace": { + "symfony/cache-contracts": "self.version", + "symfony/event-dispatcher-contracts": "self.version", + "symfony/http-client-contracts": "self.version", + "symfony/service-contracts": "self.version", + "symfony/translation-contracts": "self.version" + }, "require-dev": { "psr/cache": "^1.0", - "psr/container": "^1.0" + "psr/container": "^1.0", + "symfony/polyfill-intl-idn": "^1.10" }, "suggest": { "psr/cache": "When using the Cache contracts", "psr/container": "When using the Service contracts", - "symfony/cache-contracts-implementation": "", - "symfony/service-contracts-implementation": "", - "symfony/translation-contracts-implementation": "" + "psr/event-dispatcher": "When using the EventDispatcher contracts", + "symfony/cache-implementation": "", + "symfony/event-dispatcher-implementation": "", + "symfony/http-client-implementation": "", + "symfony/service-implementation": "", + "symfony/translation-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -3603,20 +3621,20 @@ "interoperability", "standards" ], - "time": "2018-12-05T08:06:11+00:00" + "time": "2019-05-28T07:50:59+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", "shasum": "" }, "require": { @@ -3643,7 +3661,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2019-04-04T09:56:43+00:00" }, { "name": "webmozart/assert", From 03413a62e47defa35a62422bf91eb07ceba16933 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 21:41:17 +0200 Subject: [PATCH 38/56] apply codestyle fixes --- app/src/Apikey/ApikeyApi.php | 4 +- app/src/Apikey/ApikeyController.php | 24 ++- app/src/Apikey/ApikeyDeleteFormType.php | 2 - app/src/Apikey/ApikeyEntity.php | 7 +- app/src/Application/ApplicationController.php | 39 ++-- app/src/Application/BaseApi.php | 96 +++++----- app/src/Application/BaseController.php | 8 +- app/src/Application/CacheService.php | 6 +- app/src/Application/ContactApi.php | 8 +- app/src/Application/ContactFormType.php | 10 +- app/src/Client/ClientApi.php | 15 +- app/src/Client/ClientController.php | 32 ++-- app/src/Event/EventApi.php | 23 +-- app/src/Event/EventController.php | 168 +++++++++--------- app/src/Event/EventDb.php | 12 +- app/src/Event/EventEntity.php | 3 +- app/src/Event/EventFormType.php | 2 +- app/src/Event/EventScheduler.php | 20 +-- app/src/Event/EventSchedulerDay.php | 4 +- .../DataTransformer/EventTagsTransformer.php | 2 +- app/src/Middleware/FormMiddleware.php | 4 +- app/src/Search/SearchController.php | 26 +-- app/src/Talk/TalkApi.php | 8 +- app/src/Talk/TalkController.php | 61 ++++--- app/src/Talk/TalkDb.php | 24 +-- app/src/User/AuthApi.php | 16 +- app/src/User/NewPasswordFormType.php | 10 +- app/src/User/RegisterFormType.php | 4 +- app/src/User/UserApi.php | 18 +- app/src/User/UserController.php | 128 +++++++------ app/src/User/UserDb.php | 4 +- app/src/User/UserFormType.php | 4 +- app/src/View/FunctionsExtension.php | 10 +- 33 files changed, 417 insertions(+), 385 deletions(-) diff --git a/app/src/Apikey/ApikeyApi.php b/app/src/Apikey/ApikeyApi.php index ebdf03b8a..ed6fd483a 100644 --- a/app/src/Apikey/ApikeyApi.php +++ b/app/src/Apikey/ApikeyApi.php @@ -19,7 +19,7 @@ public function getCollection($queryParams) ); $meta = array_pop($tokens); - $collectionData = array(); + $collectionData = []; foreach ($tokens['tokens'] as $item) { $talk = new ApikeyEntity($item); @@ -60,7 +60,7 @@ public function getById($id, $queryParams = ['verbose' => 'yes']) */ public function deleteClient($tokenUri) { - list ($status, $result, $headers) = $this->apiDelete($tokenUri); + list($status, $result, $headers) = $this->apiDelete($tokenUri); if ($status != 204) { $decoded = json_decode($result); diff --git a/app/src/Apikey/ApikeyController.php b/app/src/Apikey/ApikeyController.php index b27399591..7c43a3887 100644 --- a/app/src/Apikey/ApikeyController.php +++ b/app/src/Apikey/ApikeyController.php @@ -1,20 +1,18 @@ get('/user/:username/apikey', array($this, 'index'))->name('apikey-show'); - $app->get('/user/:username/apikey/:apikey/delete', array($this, 'deleteApiKey'))->via('GET', 'POST')->name('apikey-delete'); + $app->get('/user/:username/apikey', [$this, 'index'])->name('apikey-show'); + $app->get('/user/:username/apikey/:apikey/delete', [$this, 'deleteApiKey'])->via('GET', 'POST')->name('apikey-delete'); } public function index($username) @@ -64,11 +62,11 @@ public function deleteApiKey($username, $apikey) } // default values - $data = []; - $data['apikey_id'] = $apikey->getId(); + $data = []; + $data['apikey_id'] = $apikey->getId(); $factory = $this->application->formFactory; - $form = $factory->create(new ApikeyDeleteFormType(), $data); + $form = $factory->create(new ApikeyDeleteFormType(), $data); $request = $this->application->request(); @@ -87,7 +85,7 @@ public function deleteApiKey($username, $apikey) $this->application->urlFor('apikey-show', ['username' => $username]) ); return; - } catch (\RuntimeException $e) { + } catch (RuntimeException $e) { $form->adderror( new FormError('An error occurred while removing this API-Key: ' . $e->getmessage()) ); @@ -98,10 +96,10 @@ public function deleteApiKey($username, $apikey) $this->render( 'Apikey/delete.html.twig', [ - 'apikey' => $apikey, - 'form' => $form->createView(), + 'apikey' => $apikey, + 'form' => $form->createView(), 'backUri' => $this->application->urlFor('apikey-show', ['username' => $username]), - 'user' => $_SESSION['user'], + 'user' => $_SESSION['user'], ] ); } diff --git a/app/src/Apikey/ApikeyDeleteFormType.php b/app/src/Apikey/ApikeyDeleteFormType.php index edd594c6b..98d6a90e2 100644 --- a/app/src/Apikey/ApikeyDeleteFormType.php +++ b/app/src/Apikey/ApikeyDeleteFormType.php @@ -4,8 +4,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Validator\Constraints as Assert; -use JoindIn\Web\Event\EventEntity; /** * Form used to render and validate the submission or editing of a 3rd party application. diff --git a/app/src/Apikey/ApikeyEntity.php b/app/src/Apikey/ApikeyEntity.php index af1dc8b7f..e6af8a601 100644 --- a/app/src/Apikey/ApikeyEntity.php +++ b/app/src/Apikey/ApikeyEntity.php @@ -1,9 +1,8 @@ data->last_used_date); + return new DateTimeImmutable($this->data->last_used_date); } public function getCreationDateTime() { - return new \DateTimeImmutable($this->data->created_date); + return new DateTimeImmutable($this->data->created_date); } diff --git a/app/src/Application/ApplicationController.php b/app/src/Application/ApplicationController.php index 5745845ec..e9c27baed 100755 --- a/app/src/Application/ApplicationController.php +++ b/app/src/Application/ApplicationController.php @@ -1,21 +1,20 @@ get('/', array($this, 'index')); - $app->get('/about', array($this, 'about'))->name('about'); - $app->map('/contact', array($this, 'contact'))->via('GET', 'POST')->name('contact'); - $app->get('/not-allowed', array($this, 'notAllowed'))->name('not-allowed'); - $app->get('/assets', array($this, 'assets'))->name('assets'); + $app->get('/', [$this, 'index']); + $app->get('/about', [$this, 'about'])->name('about'); + $app->map('/contact', [$this, 'contact'])->via('GET', 'POST')->name('contact'); + $app->get('/not-allowed', [$this, 'notAllowed'])->name('not-allowed'); + $app->get('/assets', [$this, 'assets'])->name('assets'); } public function index() @@ -25,19 +24,19 @@ public function index() : $this->application->request()->get('page'); $perPage = 10; - $start = ($page -1) * $perPage; + $start = ($page - 1) * $perPage; - $eventApi = $this->getEventApi(); + $eventApi = $this->getEventApi(); $hotEvents = $eventApi->getEvents($perPage, $start, 'hot'); $cfpEvents = $eventApi->getEvents(4, 0, 'cfp', true); $this->render( 'Application/index.html.twig', - array( - 'events' => $hotEvents, + [ + 'events' => $hotEvents, 'cfp_events' => $cfpEvents, - 'page' => $page, - ) + 'page' => $page, + ] ); } @@ -84,8 +83,8 @@ public function contact() if ($form->isValid()) { $values = $form->getData(); - $config = $this->application->config('oauth'); - $clientId = $config['client_id']; + $config = $this->application->config('oauth'); + $clientId = $config['client_id']; $clientSecret = $config['client_secret']; try { @@ -100,7 +99,7 @@ public function contact() ); $this->application->flash('message', "Thank you for contacting us."); $this->application->redirect($this->application->urlFor("contact")); - } catch (\Exception $e) { + } catch (Exception $e) { $this->application->flashNow('error', $e->getMessage()); } } @@ -127,13 +126,11 @@ public function assets() ); } - /** * Render the notAllowed page */ public function notAllowed() { - $this->render('Application/not-allowed.html.twig', [ 'redirect' => $this->application->request->get('redirect') ]); diff --git a/app/src/Application/BaseApi.php b/app/src/Application/BaseApi.php index 11a277ef4..f70954edb 100644 --- a/app/src/Application/BaseApi.php +++ b/app/src/Application/BaseApi.php @@ -1,6 +1,8 @@ accessToken = $accessToken; } - protected function apiGet($url, $params = array()) + protected function apiGet($url, $params = []) { $paramsString = count($params) ? '?' . http_build_query($params, '', '&') : ''; - $contextOpts = array('http' => array( - 'header' => "Accept: application/json", - 'timeout' => 10, - 'ignore_errors' => true, - )); + $contextOpts = [ + 'http' => [ + 'header' => "Accept: application/json", + 'timeout' => 10, + 'ignore_errors' => true, + ] + ]; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $_SERVER['REMOTE_ADDR']; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; + $contextOpts['http']['header'] .= "\r\nForwarded: for=$ip;user-agent=\"$agent\""; if ($this->accessToken) { @@ -48,22 +53,24 @@ protected function apiGet($url, $params = array()) $result = file_get_contents($url . $paramsString, 0, $streamContext); if (false === $result) { - throw new \Exception('Unable to connect to API'); + throw new Exception('Unable to connect to API'); } return $result; } - protected function apiDelete($url, $params = array()) + protected function apiDelete($url, $params = []) { $paramsString = count($params) ? '?' . http_build_query($params, '', '&') : ''; - $contextOpts = array('http' => array( - 'method' => 'DELETE', - 'header' => "Accept: application/json", - 'timeout' => 10, - 'ignore_errors' => true, - )); + $contextOpts = [ + 'http' => [ + 'method' => 'DELETE', + 'header' => "Accept: application/json", + 'timeout' => 10, + 'ignore_errors' => true, + ] + ]; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) $ip = $_SERVER['REMOTE_ADDR']; @@ -83,7 +90,7 @@ protected function apiDelete($url, $params = array()) $result = file_get_contents($url . $paramsString, 0, $streamContext); if (false === $result) { - throw new \Exception('Unable to connect to API'); + throw new Exception('Unable to connect to API'); } $status = 0; @@ -93,19 +100,21 @@ protected function apiDelete($url, $params = array()) $headers = $this->extractListOfHeaders($http_response_header); - return array($status, $result, $headers); + return [$status, $result, $headers]; } - protected function apiPost($url, $params = array()) + protected function apiPost($url, $params = []) { - $contextOpts = array('http' => array( - 'method' => 'POST', - 'header' => "Content-type: application/json\r\n" - . "Accept: application/json", - 'content' => json_encode($params), - 'timeout' => 10, - 'ignore_errors' => true, - )); + $contextOpts = [ + 'http' => [ + 'method' => 'POST', + 'header' => "Content-type: application/json\r\n" + . "Accept: application/json", + 'content' => json_encode($params), + 'timeout' => 10, + 'ignore_errors' => true, + ] + ]; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) $ip = $_SERVER['REMOTE_ADDR']; @@ -124,7 +133,7 @@ protected function apiPost($url, $params = array()) $streamContext = stream_context_create($contextOpts); $result = file_get_contents($url, 0, $streamContext); if (false === $result) { - throw new \Exception('Unable to connect to API'); + throw new Exception('Unable to connect to API'); } $status = 0; @@ -134,23 +143,26 @@ protected function apiPost($url, $params = array()) $headers = $this->extractListOfHeaders($http_response_header); - return array($status, $result, $headers); + return [$status, $result, $headers]; } - protected function apiPut($url, $params = array()) + protected function apiPut($url, $params = []) { - $contextOpts = array('http' => array( - 'method' => 'PUT', - 'header' => "Content-type: application/json\r\n" - . "Accept: application/json", - 'content' => json_encode($params), - 'timeout' => 10, - 'ignore_errors' => true, - )); + $contextOpts = [ + 'http' => [ + 'method' => 'PUT', + 'header' => "Content-type: application/json\r\n" + . "Accept: application/json", + 'content' => json_encode($params), + 'timeout' => 10, + 'ignore_errors' => true, + ] + ]; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $_SERVER['REMOTE_ADDR']; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; + $contextOpts['http']['header'] .= "\r\nForwarded: for=$ip;user-agent=\"$agent\""; if ($this->accessToken) { @@ -165,7 +177,7 @@ protected function apiPut($url, $params = array()) $streamContext = stream_context_create($contextOpts); $result = file_get_contents($url, 0, $streamContext); if (false === $result) { - throw new \Exception('Unable to connect to API'); + throw new Exception('Unable to connect to API'); } $status = 0; @@ -175,7 +187,7 @@ protected function apiPut($url, $params = array()) $headers = $this->extractListOfHeaders($http_response_header); - return array($status, $result, $headers); + return [$status, $result, $headers]; } /** @@ -191,7 +203,7 @@ protected function apiPut($url, $params = array()) */ private function extractListOfHeaders(array $rawHeaders) { - $headers = array(); + $headers = []; foreach ($rawHeaders as $header) { $header = explode(':', $header, 2); if (count($header) < 2) { @@ -205,7 +217,7 @@ private function extractListOfHeaders(array $rawHeaders) } /** - * @param $access_token + * @param $accessToken */ public function setAccessToken($accessToken) { diff --git a/app/src/Application/BaseController.php b/app/src/Application/BaseController.php index 9aed47cf6..7e5b91f38 100644 --- a/app/src/Application/BaseController.php +++ b/app/src/Application/BaseController.php @@ -26,19 +26,19 @@ public function __construct(Slim $app) private function getConfig() { - $app = Slim::getInstance(); + $app = Slim::getInstance(); $config = $app->config('custom'); return $config; } - protected function render($template, $data = array(), $status = null) + protected function render($template, $data = [], $status = null) { try { $this->application->render($template, $data, $status); } catch (Twig_Error_Runtime $e) { $this->application->render( 'Error/app_load_error.html.twig', - array( + [ 'message' => sprintf( 'An exception has been thrown during the rendering of a template ("%s").', $e->getMessage() @@ -46,7 +46,7 @@ protected function render($template, $data = array(), $status = null) -1, null, $e - ) + ] ); } } diff --git a/app/src/Application/CacheService.php b/app/src/Application/CacheService.php index 94b874a67..f16bcaab1 100644 --- a/app/src/Application/CacheService.php +++ b/app/src/Application/CacheService.php @@ -1,6 +1,8 @@ keyPrefix = $keyPrefix; - $this->client = $client; + $this->client = $client; } public function save($collection, $data, $keyField, $keyValue) diff --git a/app/src/Application/ContactApi.php b/app/src/Application/ContactApi.php index ec72fed14..92d6d802c 100644 --- a/app/src/Application/ContactApi.php +++ b/app/src/Application/ContactApi.php @@ -1,22 +1,20 @@ baseApiUrl . '/v2.1/contact'; - $params = array( + + $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, 'name' => $name, 'email' => $email, 'subject' => $subject, 'comment' => $comment, - ); + ]; list($status, $result) = $this->apiPost($url, $params); diff --git a/app/src/Application/ContactFormType.php b/app/src/Application/ContactFormType.php index 5e1be8b58..4784bf1cd 100644 --- a/app/src/Application/ContactFormType.php +++ b/app/src/Application/ContactFormType.php @@ -5,8 +5,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; -use JoindIn\Web\Form\DataTransformer\DateTransformer; -use JoindIn\Web\Form\DataTransformer\EventTagsTransformer; /** * Form used to render and validate a contact form. @@ -61,14 +59,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'text', [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 100])], - 'max_length' => '100', + 'max_length' => '100', ] ) ->add( 'email', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], ] ) @@ -77,14 +75,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'text', [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 100])], - 'max_length' => '100', + 'max_length' => '100', ] ) ->add( 'comment', 'textarea', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank()], ] ) diff --git a/app/src/Client/ClientApi.php b/app/src/Client/ClientApi.php index e4a31c4cd..cc430e0cc 100644 --- a/app/src/Client/ClientApi.php +++ b/app/src/Client/ClientApi.php @@ -2,7 +2,6 @@ namespace JoindIn\Web\Client; use JoindIn\Web\Application\BaseApi; -use JoindIn\Web\User\UserApi; class ClientApi extends BaseApi { @@ -65,11 +64,11 @@ public function getById($id, $queryParams = ['verbose' => 'yes']) public function submit(array $data) { $values = [ - 'name' => $data['application'], - 'description' => $data['description'], + 'name' => $data['application'], + 'description' => $data['description'], 'callback_url' => $data['callback_url'], ]; - list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/applications', $values); + list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/applications', $values); if ($status != 201) { $decoded = json_decode($result); @@ -96,11 +95,11 @@ public function submit(array $data) public function editClient($clientUri, array $data) { $values = [ - 'name' => $data['application'], - 'description' => $data['description'], + 'name' => $data['application'], + 'description' => $data['description'], 'callback_url' => $data['callback_url'], ]; - list ($status, $result, $headers) = $this->apiPut($clientUri, $values); + list($status, $result, $headers) = $this->apiPut($clientUri, $values); if ($status != 201) { $decoded = json_decode($result); @@ -121,7 +120,7 @@ public function editClient($clientUri, array $data) */ public function deleteClient($clientUri) { - list ($status, $result, $headers) = $this->apiDelete($clientUri); + list($status, $result, $headers) = $this->apiDelete($clientUri); if ($status != 204) { $decoded = json_decode($result); diff --git a/app/src/Client/ClientController.php b/app/src/Client/ClientController.php index 2ebfafc90..229f56eec 100644 --- a/app/src/Client/ClientController.php +++ b/app/src/Client/ClientController.php @@ -12,11 +12,11 @@ class ClientController extends BaseController { protected function defineRoutes(Slim $app) { - $app->get('/user/:username/client', array($this, 'index'))->name('clients'); - $app->map('/user/:username/client/create', array($this, 'createClient'))->via('GET', 'POST')->name('client-create'); - $app->get('/user/:username/client/:clientName', array($this, 'showClient'))->name('client-show'); - $app->map('/user/:username/client/:clientName/edit', array($this, 'editClient'))->via('GET', 'POST')->name('client-edit'); - $app->get('/user/:username/client/:clientName/delete', array($this, 'deleteClient'))->via('GET', 'POST')->name('client-delete'); + $app->get('/user/:username/client', [$this, 'index'])->name('clients'); + $app->map('/user/:username/client/create', [$this, 'createClient'])->via('GET', 'POST')->name('client-create'); + $app->get('/user/:username/client/:clientName', [$this, 'showClient'])->name('client-show'); + $app->map('/user/:username/client/:clientName/edit', [$this, 'editClient'])->via('GET', 'POST')->name('client-edit'); + $app->get('/user/:username/client/:clientName/delete', [$this, 'deleteClient'])->via('GET', 'POST')->name('client-delete'); } public function index($username) @@ -41,7 +41,7 @@ public function index($username) $this->render('Client/index.html.twig', [ 'clients' => $clients['clients'], - 'user' => $_SESSION['user'], + 'user' => $_SESSION['user'], ]); } @@ -49,7 +49,7 @@ public function showClient($username, $clientName) { $thisUrl = $this->application->urlFor('client-show', [ 'clientName' => $clientName, - 'username' => $username, + 'username' => $username, ]); if (!isset($_SESSION['user'])) { @@ -74,7 +74,7 @@ public function showClient($username, $clientName) $this->render('Client/details.html.twig', [ 'client' => $client, - 'user' => $_SESSION['user'] + 'user' => $_SESSION['user'] ]); } @@ -116,11 +116,11 @@ public function createClient($username) $this->render( 'Client/submit.html.twig', [ - 'form' => $form->createView(), + 'form' => $form->createView(), 'backUri' => $this->application->urlFor('clients', [ 'username' => $username, ]), - 'user' => $_SESSION['user'] + 'user' => $_SESSION['user'] ] ); } @@ -190,13 +190,13 @@ public function editClient($username, $clientName) $this->render( 'Client/edit-client.html.twig', [ - 'client' => $client, - 'form' => $form->createView(), + 'client' => $client, + 'form' => $form->createView(), 'backUri' => $this->application->urlFor('client-show', [ 'clientName' => $client->getId(), 'username' => $username, ]), - 'user' => $_SESSION['user'], + 'user' => $_SESSION['user'], ] ); } @@ -293,13 +293,13 @@ public function deleteClient($username, $clientName) $this->render( 'Client/delete-client.html.twig', [ - 'client' => $client, - 'form' => $form->createView(), + 'client' => $client, + 'form' => $form->createView(), 'backUri' => $this->application->urlFor('client-show', [ 'clientName' => $client->getId(), 'username' => $username ]), - 'user' => $_SESSION['user'] + 'user' => $_SESSION['user'] ] ); } diff --git a/app/src/Event/EventApi.php b/app/src/Event/EventApi.php index e84864f21..80cb78c88 100644 --- a/app/src/Event/EventApi.php +++ b/app/src/Event/EventApi.php @@ -42,8 +42,9 @@ public function __construct($config, $accessToken, EventDb $eventDb, UserApi $us public function getEvents($limit = 10, $start = 1, $filter = null, $verbose = false, array $queryParams = []) { $url = $this->baseApiUrl . '/v2.1/events'; + $queryParams['resultsperpage'] = $limit; - $queryParams['start'] = $start; + $queryParams['start'] = $start; if ($filter) { $queryParams['filter'] = $filter; @@ -102,7 +103,7 @@ public function getByStub($stub) */ public function getEvent($event_uri, $verbose = true) { - $params = array(); + $params = []; if ($verbose) { $params['verbose'] = 'yes'; } @@ -155,7 +156,7 @@ public function getComments($comment_uri, $verbose = false) $comments = (array)json_decode($this->apiGet($comment_uri)); - $commentData = array(); + $commentData = []; foreach ($comments['comments'] as $comment) { $commentData[] = new EventCommentEntity($comment); @@ -167,10 +168,10 @@ public function getComments($comment_uri, $verbose = false) public function addComment(EventEntity $event, $comment, $rating = 0) { $uri = $event->getCommentsUri(); - $params = array( + $params = [ 'comment' => $comment, 'rating' => $rating, - ); + ]; list ($status, $result) = $this->apiPost($uri, $params); if ($status == 201) { @@ -230,7 +231,7 @@ public function getAttendees($attendees_uri, $limit = 0, $verbose = false) $attendees = (array)json_decode($this->apiGet($attendees_uri)); - $attendeeData = array(); + $attendeeData = []; foreach ($attendees['users'] as $attendee) { $attendeeData[] = new UserEntity($attendee); @@ -254,7 +255,7 @@ public function getAttendees($attendees_uri, $limit = 0, $verbose = false) public function submit(array $data) { // Convert datetime objects to strings - $dateFields = array('start_date', 'end_date', 'cfp_start_date', 'cfp_end_date'); + $dateFields = ['start_date', 'end_date', 'cfp_start_date', 'cfp_end_date']; foreach ($dateFields as $dateField) { if (isset($data[$dateField]) && $data[$dateField] instanceof DateTime) { $data[$dateField] = $data[$dateField]->format('Y-m-d'); @@ -300,7 +301,7 @@ public function submit(array $data) public function edit(array $data) { // Convert datetime objects to strings - $dateFields = array('start_date', 'end_date', 'cfp_start_date', 'cfp_end_date'); + $dateFields = ['start_date', 'end_date', 'cfp_start_date', 'cfp_end_date']; foreach ($dateFields as $dateField) { if (isset($data[$dateField]) && $data[$dateField] instanceof DateTime) { $data[$dateField] = $data[$dateField]->format('c'); @@ -387,12 +388,12 @@ public function uploadIcon($imagesUri, $fileName) * * @return array */ - public function getCollection($uri, array $queryParams = array()) + public function getCollection($uri, array $queryParams = []) { $events = (array)json_decode($this->apiGet($uri, $queryParams)); $meta = array_pop($events); - $collectionData = array(); + $collectionData = []; foreach ($events['events'] as $item) { $event = new EventEntity($item); @@ -437,7 +438,7 @@ public function getTalkComments($comment_uri, $limit = 10, $start = 1, $verbose $meta = array_pop($comments); - $commentData = array(); + $commentData = []; foreach ($comments['comments'] as $item) { if (isset($item->user_uri)) { diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index 12de6f03f..c61cd53ed 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -34,42 +34,42 @@ public function __construct(Slim $app) protected function defineRoutes(Slim $app) { // named routes first; should an event pick the same name then at least our actions take precedence - $app->get('/event', array($this, 'index'))->name("events-index"); - $app->get('/event/pending', array($this, 'pending'))->name("events-pending"); - $app->map('/event/submit', array($this, 'submit'))->via('GET', 'POST')->name('event-submit'); - $app->get('/event/callforpapers', array($this, 'callForPapers'))->name('event-call-for-papers'); - $app->get('/event/:friendly_name', array($this, 'eventDefault'))->name("event-default"); - $app->get('/event/:friendly_name/details', array($this, 'details'))->name("event-detail"); - $app->get('/event/:friendly_name/attendees', array($this, 'attendees'))->name("event-attendees"); - $app->get('/event/:friendly_name/slides', array($this, 'slides'))->name("event-slides"); - $app->get('/event/:friendly_name/comments', array($this, 'comments'))->name("event-comments"); - $app->get('/event/:friendly_name/comments/:comment_hash/report', array($this, 'reportComment')) + $app->get('/event', [$this, 'index'])->name("events-index"); + $app->get('/event/pending', [$this, 'pending'])->name("events-pending"); + $app->map('/event/submit', [$this, 'submit'])->via('GET', 'POST')->name('event-submit'); + $app->get('/event/callforpapers', [$this, 'callForPapers'])->name('event-call-for-papers'); + $app->get('/event/:friendly_name', [$this, 'eventDefault'])->name("event-default"); + $app->get('/event/:friendly_name/details', [$this, 'details'])->name("event-detail"); + $app->get('/event/:friendly_name/attendees', [$this, 'attendees'])->name("event-attendees"); + $app->get('/event/:friendly_name/slides', [$this, 'slides'])->name("event-slides"); + $app->get('/event/:friendly_name/comments', [$this, 'comments'])->name("event-comments"); + $app->get('/event/:friendly_name/comments/:comment_hash/report', [$this, 'reportComment']) ->name("event-comments-reported"); - $app->get('/event/:friendly_name/schedule', array($this, 'schedule'))->name("event-schedule"); - $app->get('/event/:friendly_name/schedule/list(/:starred)', array($this, 'scheduleList'))->name("event-schedule-list"); - $app->get('/event/:friendly_name/schedule/grid(/:starred)', array($this, 'scheduleGrid'))->name("event-schedule-grid"); - $app->get('/event/:friendly_name/talk-comments', array($this, 'talkComments'))->name("event-talk-comments"); - $app->post('/event/:friendly_name/add-comment', array($this, 'addComment'))->name('event-add-comment'); - $app->map('/event/:friendly_name/edit', array($this, 'edit'))->via('GET', 'POST')->name('event-edit'); - $app->get('/e/:stub', array($this, 'quicklink'))->name("event-quicklink"); - $app->get('/event/xhr-attend/:friendly_name', array($this, 'xhrAttend')); - $app->get('/event/xhr-unattend/:friendly_name', array($this, 'xhrUnattend')); - $app->get('/event/attend/:friendly_name', array($this, 'attend'))->name("event-attend"); - $app->get('/event/unattend/:friendly_name', array($this, 'unattend'))->name("event-unattend"); - $app->post('/event/action-pending-event/:friendly_name', array($this, 'actionPendingEvent')) + $app->get('/event/:friendly_name/schedule', [$this, 'schedule'])->name("event-schedule"); + $app->get('/event/:friendly_name/schedule/list(/:starred)', [$this, 'scheduleList'])->name("event-schedule-list"); + $app->get('/event/:friendly_name/schedule/grid(/:starred)', [$this, 'scheduleGrid'])->name("event-schedule-grid"); + $app->get('/event/:friendly_name/talk-comments', [$this, 'talkComments'])->name("event-talk-comments"); + $app->post('/event/:friendly_name/add-comment', [$this, 'addComment'])->name('event-add-comment'); + $app->map('/event/:friendly_name/edit', [$this, 'edit'])->via('GET', 'POST')->name('event-edit'); + $app->get('/e/:stub', [$this, 'quicklink'])->name("event-quicklink"); + $app->get('/event/xhr-attend/:friendly_name', [$this, 'xhrAttend']); + $app->get('/event/xhr-unattend/:friendly_name', [$this, 'xhrUnattend']); + $app->get('/event/attend/:friendly_name', [$this, 'attend'])->name("event-attend"); + $app->get('/event/unattend/:friendly_name', [$this, 'unattend'])->name("event-unattend"); + $app->post('/event/action-pending-event/:friendly_name', [$this, 'actionPendingEvent']) ->name("event-action-pending"); - $app->get('/event/view/:eventId(/:extra+)', array($this, 'redirectFromId')) + $app->get('/event/view/:eventId(/:extra+)', [$this, 'redirectFromId']) ->name('event-redirect-from-id') - ->conditions(array('eventId' => '\d+')); - $app->get('/event/:friendly_name/reported-comments', array($this, 'reportedComments')) + ->conditions(['eventId' => '\d+']); + $app->get('/event/:friendly_name/reported-comments', [$this, 'reportedComments']) ->name("event-reported-comments"); - $app->post('/event/:friendly_name/moderate-comment', array($this, 'moderateComment')) + $app->post('/event/:friendly_name/moderate-comment', [$this, 'moderateComment']) ->name("event-moderate-comment"); - $app->map('/event/:friendly_name/add-talk', array($this, 'addTalk'))->via('GET', 'POST') + $app->map('/event/:friendly_name/add-talk', [$this, 'addTalk'])->via('GET', 'POST') ->name("event-add-talk"); - $app->map('/event/:friendly_name/edit-tracks', array($this, 'editTracks'))->via('GET', 'POST') + $app->map('/event/:friendly_name/edit-tracks', [$this, 'editTracks'])->via('GET', 'POST') ->name("event-edit-tracks"); - $app->map('/event/:friendly_name/claims', array($this, 'talkClaims'))->via('GET', 'POST') + $app->map('/event/:friendly_name/claims', [$this, 'talkClaims'])->via('GET', 'POST') ->name("event-talk-claims"); } @@ -106,11 +106,11 @@ public function index() $this->render( 'Event/index.html.twig', - array( + [ 'page' => $page, 'cfp_events' => $cfpEvents, 'events' => $events - ) + ] ); } @@ -137,10 +137,10 @@ public function pending() $this->render( 'Event/pending.html.twig', - array( + [ 'page' => $page, 'events' => $events - ) + ] ); } @@ -161,10 +161,10 @@ public function callForPapers() $this->render( 'Event/call-for-papers.html.twig', - array( + [ 'page' => $page, 'events' => $events, - ) + ] ); } @@ -209,18 +209,18 @@ public function details($friendly_name) } $quicklink = $this->application->request()->headers("host") - . $this->application->urlFor('event-quicklink', array('stub' => $event->getStub())); + . $this->application->urlFor('event-quicklink', ['stub' => $event->getStub()]); $attendees = $eventApi->getAttendees($event->getAttendeesUri(), 6, true); $this->render( 'Event/details.html.twig', - array( + [ 'event' => $event, 'quicklink' => $quicklink, 'attendees' => $attendees - ) + ] ); } @@ -238,11 +238,11 @@ public function attendees($friendly_name) $this->render( 'Event/_common/event_attendees.html.twig', - array( + [ 'event' => $event, 'fullList' => true, 'attendees' => $attendees - ) + ] ); } @@ -255,16 +255,16 @@ public function comments($friendly_name) } $quicklink = $this->application->request()->headers("host") - . $this->application->urlFor('event-quicklink', array('stub' => $event->getStub())); + . $this->application->urlFor('event-quicklink', ['stub' => $event->getStub()]); $comments = $eventApi->getComments($event->getCommentsUri(), true); $this->render( 'Event/comments.html.twig', - array( + [ 'event' => $event, 'quicklink' => $quicklink, 'comments' => $comments, - ) + ] ); } @@ -287,19 +287,19 @@ public function talkComments($friendly_name) ); // If we have comments, fetch talk slugs for the talks so that we can create links to them in the template - $slugs = array(); + $slugs = []; if (array_key_exists('comments', $comments) && $comments['pagination']->count > 0) { $slugs = $this->getTalkSlugsForTalkComments($comments['comments'], $event); } $this->render( 'Event/talk-comments.html.twig', - array( + [ 'event' => $event, 'page' => $page, 'talkComments' => $comments, 'talkSlugs' => $slugs, - ) + ] ); } else { $events_url = $this->application->urlFor("events-index"); @@ -331,10 +331,10 @@ public function slides($friendly_name) $agenda = $this->getTalkApi()->getAgenda($event->getTalksUri()); - $this->render('Event/slides.html.twig', array( + $this->render('Event/slides.html.twig', [ 'event' => $event, 'agenda' => $agenda, - )); + ]); } public function scheduleList($friendly_name, $starred = false) @@ -361,13 +361,13 @@ public function scheduleList($friendly_name, $starred = false) $currentUrlWithoutStarred .= $expectedUrlSuffix; } - $this->render('Event/schedule-list.html.twig', array( - 'event' => $event, - 'agenda' => $agenda, - 'starred' => $starred, + $this->render('Event/schedule-list.html.twig', [ + 'event' => $event, + 'agenda' => $agenda, + 'starred' => $starred, 'starred_only' => $starredOnly, - 'current_url' => $currentUrlWithoutStarred - )); + 'current_url' => $currentUrlWithoutStarred + ]); } public function scheduleGrid($friendly_name, $starred = false) @@ -396,13 +396,13 @@ public function scheduleGrid($friendly_name, $starred = false) $currentUrlWithoutStarred .= $expectedUrlSuffix; } - $this->render('Event/schedule-grid.html.twig', array( - 'event' => $event, - 'eventDays' => $schedule, - 'starred' => $starred, + $this->render('Event/schedule-grid.html.twig', [ + 'event' => $event, + 'eventDays' => $schedule, + 'starred' => $starred, 'starred_only' => $starredOnly, - 'current_url' => $currentUrlWithoutStarred - )); + 'current_url' => $currentUrlWithoutStarred + ]); } public function quicklink($stub) @@ -421,7 +421,7 @@ public function addComment($friendly_name) $request = $this->application->request(); $comment = $request->post('comment'); $rating = (int) $request->post('rating'); - $url = $this->application->urlFor("event-comments", array('friendly_name' => $friendly_name)); + $url = $this->application->urlFor("event-comments", ['friendly_name' => $friendly_name]); $url .= '#add-comment'; $eventApi = $this->getEventApi(); @@ -457,7 +457,7 @@ public function reportComment($friendly_name, $comment_hash) { $eventApi = $this->getEventApi(); $event = $eventApi->getByFriendlyUrl($friendly_name); - $url = $this->application->urlFor("event-comments", array('friendly_name' => $friendly_name)); + $url = $this->application->urlFor("event-comments", ['friendly_name' => $friendly_name]); $comments = $eventApi->getComments($event->getCommentsUri()); foreach ($comments as $comment) { @@ -553,10 +553,10 @@ public function submit() $this->render( 'Event/submit.html.twig', - array( + [ 'form' => $form->createView(), 'timezones' => EventFormType::getNestedListOfTimezones(), - ) + ] ); } @@ -595,11 +595,11 @@ public function edit($friendly_name) $this->render( 'Event/edit.html.twig', - array( + [ 'event' => $event, 'form' => $form->createView(), 'timezones' => EventFormType::getNestedListOfTimezones(), - ) + ] ); } @@ -660,28 +660,28 @@ public function redirectFromId($eventId, $extra = false) $this->application->redirect( $this->application->urlFor( 'event-talk-comments', - array('friendly_name' => $event->getUrlFriendlyName()) + ['friendly_name' => $event->getUrlFriendlyName()] ) ); } if ($extra && is_array($extra) && ($extra[0] == "comments")) { $this->application->redirect( $this->application->urlFor( 'event-comments', - array('friendly_name' => $event->getUrlFriendlyName()) + ['friendly_name' => $event->getUrlFriendlyName()] ) ); } if ($extra && is_array($extra) && ($extra[0] == "talks")) { $this->application->redirect( $this->application->urlFor( 'event-schedule', - array('friendly_name' => $event->getUrlFriendlyName()) + ['friendly_name' => $event->getUrlFriendlyName()] ) ); } else { $this->application->redirect( $this->application->urlFor( 'event-default', - array('friendly_name' => $event->getUrlFriendlyName()) + ['friendly_name' => $event->getUrlFriendlyName()] ) ); } @@ -814,7 +814,7 @@ private function redirectToListPage() private function redirectToDetailPage($friendlyName, $status = 302) { $this->application->redirect( - $this->application->urlFor('event-detail', array('friendly_name' => $friendlyName)), + $this->application->urlFor('event-detail', ['friendly_name' => $friendlyName]), $status ); } @@ -830,7 +830,7 @@ public function xhrAttend($friendly_name) $result = $this->getEventApi()->attend($event, $_SESSION['user']); } - $this->application->response()->body(json_encode(array('success' => $result))); + $this->application->response()->body(json_encode(['success' => $result])); } public function xhrUnattend($friendly_name) @@ -844,7 +844,7 @@ public function xhrUnattend($friendly_name) $result = $this->getEventApi()->unattend($event, $_SESSION['user']); } - $this->application->response()->body(json_encode(array('success' => $result))); + $this->application->response()->body(json_encode(['success' => $result])); } public function reportedComments($friendly_name) @@ -867,11 +867,11 @@ public function reportedComments($friendly_name) $this->render( 'Event/reported-comments.html.twig', - array( + [ 'event' => $event, 'eventComments' => $eventComments, 'talkComments' => $talkComments, - ) + ] ); } else { $events_url = $this->application->urlFor("events-index"); @@ -966,10 +966,10 @@ public function talkClaims($friendly_name) $this->render( 'Event/pending-claims.html.twig', - array( + [ 'event' => $event, 'claims' => $claims, - ) + ] ); } } @@ -1061,10 +1061,10 @@ public function addTalk($friendly_name) $this->render( 'Event/add-talk.html.twig', - array( + [ 'event' => $event, 'form' => $form->createView(), - ) + ] ); } @@ -1131,7 +1131,7 @@ public function editTracks($friendly_name) $this->application->redirect( $this->application->urlFor( 'event-edit-tracks', - array('friendly_name' => $event->getUrlFriendlyName()) + ['friendly_name' => $event->getUrlFriendlyName()] ) ); } catch (\Exception $e) { @@ -1144,10 +1144,10 @@ public function editTracks($friendly_name) $this->render( 'Event/edit-tracks.html.twig', - array( + [ 'event' => $event, 'form' => $form->createView(), - ) + ] ); } @@ -1176,7 +1176,7 @@ private function getTalkSlugsForTalkComments(array $comments, EventEntity $event private function getTalkSlugsFromDb(array $comments) { $talkDb = $this->getTalkDb(); - $slugs = array(); + $slugs = []; /** @var \JoindIn\Web\Talk\TalkCommentEntity $comment */ foreach ($comments as $comment) { @@ -1198,7 +1198,7 @@ private function getTalkSlugsFromApi(EventEntity $event) // Fetch talks from the API $talks = $talkApi->getCollection( $event->getTalksUri(), - array('resultsperpage' => 100) // Make sure we get all talks with a single request + ['resultsperpage' => 100] // Make sure we get all talks with a single request ); $slugs = []; diff --git a/app/src/Event/EventDb.php b/app/src/Event/EventDb.php index d09630299..e1db1847b 100644 --- a/app/src/Event/EventDb.php +++ b/app/src/Event/EventDb.php @@ -14,13 +14,13 @@ public function __construct(CacheService $cache) public function save(EventEntity $event) { - $data = array( + $data = [ "url_friendly_name" => $event->getUrlFriendlyName(), - "uri" => $event->getUri(), - "stub" => $event->getStub(), - "verbose_uri" => $event->getVerboseUri(), - "name" => $event->getName(), - ); + "uri" => $event->getUri(), + "stub" => $event->getStub(), + "verbose_uri" => $event->getVerboseUri(), + "name" => $event->getName(), + ]; $this->cache->save($this->keyName, $data, 'uri', $event->getUri()); $this->cache->save($this->keyName, $data, 'url_friendly_name', $event->getUrlFriendlyName()); diff --git a/app/src/Event/EventEntity.php b/app/src/Event/EventEntity.php index 0dcf3601c..59b665a62 100644 --- a/app/src/Event/EventEntity.php +++ b/app/src/Event/EventEntity.php @@ -449,7 +449,8 @@ public function getCfpStatus() { if (!empty($this->getCfpStartDate()) && !empty($this->getCfpEndDate())) { $startDate = DateTime::createFromFormat(DateTime::ISO8601, $this->getCfpStartDate()); - $endDate = DateTime::createFromFormat(DateTime::ISO8601, $this->getCfpEndDate()); + $endDate = DateTime::createFromFormat(DateTime::ISO8601, $this->getCfpEndDate()); + $now = new DateTime(null, $endDate->getTimezone()); $now->setTime(0, 0, 0); diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index cec173a0f..dc69bd3c5 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -288,7 +288,7 @@ public static function getNestedListOfTimezones() $timezones = \DateTimeZone::listIdentifiers(); array_pop($timezones); // Remove UTC from the end of the list - $result = array(); + $result = []; foreach ($timezones as $timezone) { list($continent, $city) = explode('/', $timezone, 2); $result[$continent][] = $city; diff --git a/app/src/Event/EventScheduler.php b/app/src/Event/EventScheduler.php index 159048d49..f6501cdcd 100644 --- a/app/src/Event/EventScheduler.php +++ b/app/src/Event/EventScheduler.php @@ -63,7 +63,7 @@ public function getTalks($talks_uri) public function getEventDays($talks) { if (empty($talks) || empty($talks['talks'])) { - return array(); + return []; } $talks = $talks['talks']; @@ -71,7 +71,7 @@ public function getEventDays($talks) $tracksByDay = $this->getTracksByDay($talks); - $eventDays = array(); + $eventDays = []; foreach ($talksByDay as $date => $talks) { $eventDays[] = new EventSchedulerDay($date, $talks, $tracksByDay[$date]); } @@ -89,18 +89,18 @@ public function getEventDays($talks) */ protected function organiseTalksByDayAndTime($talks) { - $talksByDay = array(); + $talksByDay = []; foreach ($talks as $talk) { $dateTime = $talk->getStartDateTime(); - $date = $dateTime->format('d-m-Y'); - $time = $dateTime->format('H:i'); + $date = $dateTime->format('d-m-Y'); + $time = $dateTime->format('H:i'); if (!isset($talksByDay[$date]) || !array_key_exists($date, $talksByDay)) { - $talksByDay[$date] = array(); + $talksByDay[$date] = []; } if (!isset($talksByDay[$date][$time]) || !array_key_exists($time, $talksByDay[$date])) { - $talksByDay[$date][$time] = array(); + $talksByDay[$date][$time] = []; } $talksByDay[$date][$time][] = $talk; @@ -118,14 +118,14 @@ protected function organiseTalksByDayAndTime($talks) */ protected function getTracksByDay($talks) { - $tracksByDay = array(); + $tracksByDay = []; foreach ($talks as $talk) { $dateTime = $talk->getStartDateTime(); - $date = $dateTime->format('d-m-Y'); + $date = $dateTime->format('d-m-Y'); if (!isset($tracksByDay[$date]) || !array_key_exists($date, $tracksByDay)) { - $tracksByDay[$date] = array(); + $tracksByDay[$date] = []; } $tracks = $talk->getTracks(); diff --git a/app/src/Event/EventSchedulerDay.php b/app/src/Event/EventSchedulerDay.php index b574a30b6..6c53cfce6 100644 --- a/app/src/Event/EventSchedulerDay.php +++ b/app/src/Event/EventSchedulerDay.php @@ -35,8 +35,8 @@ class EventSchedulerDay */ public function __construct($date, $talks, $tracks) { - $this->date = $date; - $this->talks = $talks; + $this->date = $date; + $this->talks = $talks; $this->tracks = $tracks; } diff --git a/app/src/Form/DataTransformer/EventTagsTransformer.php b/app/src/Form/DataTransformer/EventTagsTransformer.php index ca69d2137..61e9c51d5 100644 --- a/app/src/Form/DataTransformer/EventTagsTransformer.php +++ b/app/src/Form/DataTransformer/EventTagsTransformer.php @@ -15,7 +15,7 @@ public function transform($value) public function reverseTransform($value) { - if (is_Array($value)) { + if (is_array($value)) { return $value; } return array_map('trim', explode(',', $value)); diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 849e49769..4a7b71060 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -140,7 +140,7 @@ private function getChainingLoader($env) { $loader = $env->getLoader(); if (!$loader instanceof \Twig_Loader_Chain) { - $loader = new \Twig_Loader_Chain(array($loader)); + $loader = new \Twig_Loader_Chain([$loader]); $env->setLoader($loader); } @@ -170,7 +170,7 @@ private function addFormTemplatesFolderToLoader(\Twig_Loader_Chain $loader) */ private function createFormTwigExtension($formLayoutTemplate) { - return new FormExtension(new TwigRenderer(new TwigRendererEngine(array($formLayoutTemplate)))); + return new FormExtension(new TwigRenderer(new TwigRendererEngine([$formLayoutTemplate]))); } /** diff --git a/app/src/Search/SearchController.php b/app/src/Search/SearchController.php index a1bb30ce3..ba84fb38a 100644 --- a/app/src/Search/SearchController.php +++ b/app/src/Search/SearchController.php @@ -39,8 +39,8 @@ public function __construct(Slim $app) */ protected function defineRoutes(Slim $app) { - $app->get('/search/events', array($this, 'searchEvents'))->name("search-events"); - $app->get('/search', array($this, 'search'))->name("search"); + $app->get('/search/events', [$this, 'searchEvents'])->name("search-events"); + $app->get('/search', [$this, 'search'])->name("search"); } /** @@ -76,7 +76,7 @@ public function searchEvents() $keyword = $this->sanitizeKeyword($this->application->request()->get('keyword')); $tag = $this->sanitizeTag($this->application->request()->get('tag')); - $events = array(); + $events = []; $page = ((int)$this->application->request()->get('page') === 0) ? 1 @@ -88,12 +88,12 @@ public function searchEvents() $this->render( 'Event/search.html.twig', - array( + [ 'events' => $events, 'page' => $page, 'keyword' => $keyword, 'tag' => $tag - ) + ] ); } @@ -103,11 +103,11 @@ public function searchEvents() public function search() { $keyword = $this->sanitizeKeyword($this->application->request()->get('keyword')); - $events = array(); - $talks = array(); - $users = array(); - $eventInfo = array(); - $pagination = array(); + $events = []; + $talks = []; + $users = []; + $eventInfo = []; + $pagination = []; $page = ((int)$this->application->request()->get('page') === 0) ? 1 @@ -130,7 +130,7 @@ public function search() $this->render( 'Application/search.html.twig', - array( + [ 'events' => $events, 'eventInfo' => $eventInfo, 'talks' => $talks, @@ -138,7 +138,7 @@ public function search() 'page' => $page, 'pagination' => $pagination, 'keyword' => $keyword - ) + ] ); } @@ -151,7 +151,7 @@ public function search() */ private function searchEventsByTitleAndTag($page, $keyword, $tag = null) { - $apiQueryParams = array(); + $apiQueryParams = []; if (!empty($keyword)) { $apiQueryParams['title'] = $keyword; diff --git a/app/src/Talk/TalkApi.php b/app/src/Talk/TalkApi.php index f29726a78..440455ffb 100644 --- a/app/src/Talk/TalkApi.php +++ b/app/src/Talk/TalkApi.php @@ -47,7 +47,7 @@ public function getCollection($talks_uri, array $queryParams = []) ); $meta = array_pop($talks); - $collectionData = array(); + $collectionData = []; foreach ($talks['talks'] as $item) { $talk = new TalkEntity($item); @@ -149,7 +149,7 @@ public function getComments($comment_uri, $verbose = false, $limitTo = null) $comments = (array)json_decode($this->apiGet($comment_uri, $params)); - $commentData = array(); + $commentData = []; foreach ($comments['comments'] as $item) { if (isset($item->user_uri)) { @@ -172,10 +172,10 @@ public function getComments($comment_uri, $verbose = false, $limitTo = null) public function addComment($talk, $rating, $comment) { $uri = $talk->getCommentsUri(); - $params = array( + $params = [ 'rating' => $rating, 'comment' => $comment, - ); + ]; list ($status, $result) = $this->apiPost($uri, $params); if ($status == 201) { diff --git a/app/src/Talk/TalkController.php b/app/src/Talk/TalkController.php index b7ae3275c..d0324a0f0 100644 --- a/app/src/Talk/TalkController.php +++ b/app/src/Talk/TalkController.php @@ -18,23 +18,32 @@ class TalkController extends BaseController { protected function defineRoutes(Slim $app) { - $app->get('/event/:eventSlug/:talkSlug', array($this, 'index'))->name('talk'); - $app->map('/event/:eventSlug/:talkSlug/edit', array($this, 'editTalk'))->via('GET', 'POST')->name('talk-edit'); - $app->post('/event/:eventSlug/:talkSlug/star', array($this, 'star'))->name('talk-star'); - $app->get('/talk/:talkStub', array($this, 'quick'))->name('talk-quicklink'); - $app->get('/event/:eventSlug/:talkSlug/comments/:commentHash/report', array($this, 'reportComment')) + $app->get('/event/:eventSlug/:talkSlug', [$this, 'index']) + ->name('talk'); + $app->map('/event/:eventSlug/:talkSlug/edit', [$this, 'editTalk']) + ->via('GET', 'POST') + ->name('talk-edit'); + $app->post('/event/:eventSlug/:talkSlug/star', [$this, 'star']) + ->name('talk-star'); + $app->get('/talk/:talkStub', [$this, 'quick']) + ->name('talk-quicklink'); + $app->get('/event/:eventSlug/:talkSlug/comments/:commentHash/report', [$this, 'reportComment']) ->name('talk-report-comment'); - $app->post('/event/:eventSlug/:talkSlug/add-comment', array($this, 'addComment'))->name('talk-add-comment'); - $app->get('/:talkId', array($this, 'quickById')) + $app->post('/event/:eventSlug/:talkSlug/add-comment', [$this, 'addComment']) + ->name('talk-add-comment'); + $app->get('/:talkId', [$this, 'quickById']) ->name('talk-quick-by-id') - ->conditions(array('talkId' => '\d+')); - $app->get('/talk/view/:talkId', array($this, 'quickById')) + ->conditions(['talkId' => '\d+']); + $app->get('/talk/view/:talkId', [$this, 'quickById']) ->name('talk-by-id-web1') - ->conditions(array('talkId' => '\d+')); - $app->post('/event/:eventSlug/:talkSlug/claim', array($this, 'claimTalk'))->name('talk-claim'); - $app->get('/event/:eventSlug/:talkSlug/unlink/:username', array($this, 'unlinkSpeaker')) + ->conditions(['talkId' => '\d+']); + $app->post('/event/:eventSlug/:talkSlug/claim', [$this, 'claimTalk']) + ->name('talk-claim'); + $app->get('/event/:eventSlug/:talkSlug/unlink/:username', [$this, 'unlinkSpeaker']) ->name('unlink-speaker'); - $app->map('/event/:eventSlug/:talkSlug/delete', array($this, 'deleteTalk'))->via('GET', 'POST')->name('talk-delete'); + $app->map('/event/:eventSlug/:talkSlug/delete', [$this, 'deleteTalk']) + ->via('GET', 'POST') + ->name('talk-delete'); } public function index($eventSlug, $talkSlug) @@ -79,15 +88,15 @@ public function index($eventSlug, $talkSlug) $this->render( 'Talk/index.html.twig', - array( - 'talk' => $talk, - 'event' => $event, - 'comments' => $comments, - 'talkSlug' => $talkSlug, + [ + 'talk' => $talk, + 'event' => $event, + 'comments' => $comments, + 'talkSlug' => $talkSlug, 'canEditTalk' => $canEditTalk, 'canRateTalk' => $canRateTalk, 'unclaimed' => $unclaimed, - ) + ] ); } @@ -260,10 +269,10 @@ public function claimTalk($eventSlug, $talkSlug) try { $talkApi->claimTalk( $talk->getSpeakersUri(), - array( + [ 'display_name' => $display_name, 'username' => $_SESSION['user']->getUsername() - ) + ] ); $this->application->flash( @@ -278,7 +287,7 @@ public function claimTalk($eventSlug, $talkSlug) $this->application->flash('claimerror', "No speaker {$display_name} found for this talk."); } - $url = $this->application->urlFor("talk", array('eventSlug' => $eventSlug, 'talkSlug' => $talkSlug)); + $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); $this->application->redirect($url); } @@ -325,7 +334,7 @@ public function quick($talkStub) $this->application->redirect( $this->application->urlFor( 'talk', - array('eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk['slug']) + ['eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk['slug']] ) ); } @@ -354,7 +363,7 @@ public function quickById($talkId) $this->application->redirect( $this->application->urlFor( 'talk', - array('eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk->getUrlFriendlyTalkTitle()) + ['eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk->getUrlFriendlyTalkTitle()] ) ); } @@ -364,7 +373,7 @@ public function addComment($eventSlug, $talkSlug) $request = $this->application->request(); $comment = trim(strip_tags($request->post('comment'))); $rating = (int) $request->post('rating'); - $url = $this->application->urlFor("talk", array('eventSlug' => $eventSlug, 'talkSlug' => $talkSlug)); + $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); if ($comment == '' || $rating == 0) { $this->application->flash('error', 'Please provide a comment and rating'); @@ -428,7 +437,7 @@ public function reportComment($eventSlug, $talkSlug, $commentHash) $event = $eventApi->getByFriendlyUrl($eventSlug); $talkApi = $this->getTalkApi(); $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); - $url = $this->application->urlFor("talk", array('eventSlug' => $eventSlug, 'talkSlug' => $talkSlug)); + $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); $comments = $talkApi->getComments($talk->getCommentsUri()); foreach ($comments as $comment) { diff --git a/app/src/Talk/TalkDb.php b/app/src/Talk/TalkDb.php index 1387b7099..0a4d221d4 100644 --- a/app/src/Talk/TalkDb.php +++ b/app/src/Talk/TalkDb.php @@ -14,10 +14,10 @@ public function __construct(CacheService $cache) public function getUriFor($slug, $eventUri) { - $data = $this->cache->loadByKeys($this->keyName, array( + $data = $this->cache->loadByKeys($this->keyName, [ 'event_uri' => $eventUri, 'slug' => $slug - )); + ]); if ($data) { return $data['uri']; @@ -38,14 +38,14 @@ public function getSlugFor($talkUri) public function save(TalkEntity $talk) { - $data = array( - 'uri' => $talk->getApiUri(), - 'title' => $talk->getTitle(), - 'slug' => $talk->getUrlFriendlyTalkTitle(), + $data = [ + 'uri' => $talk->getApiUri(), + 'title' => $talk->getTitle(), + 'slug' => $talk->getUrlFriendlyTalkTitle(), 'verbose_uri' => $talk->getApiUri(true), - 'event_uri' => $talk->getEventUri(), - 'stub' => $talk->getStub(), - ); + 'event_uri' => $talk->getEventUri(), + 'stub' => $talk->getStub(), + ]; $savedTalk = $this->load('uri', $talk->getApiUri()); if ($savedTalk) { @@ -53,10 +53,10 @@ public function save(TalkEntity $talk) $data = array_merge($savedTalk, $data); } - $keys = array( + $keys = [ 'event_uri' => $talk->getEventUri(), - 'slug' => $talk->getUrlFriendlyTalkTitle() - ); + 'slug' => $talk->getUrlFriendlyTalkTitle() + ]; $this->cache->saveByKeys($this->keyName, $data, $keys); $this->cache->save($this->keyName, $data, 'uri', $talk->getApiUri()); $this->cache->save($this->keyName, $data, 'stub', $talk->getStub()); diff --git a/app/src/User/AuthApi.php b/app/src/User/AuthApi.php index f17d679e5..962522536 100644 --- a/app/src/User/AuthApi.php +++ b/app/src/User/AuthApi.php @@ -17,13 +17,13 @@ class AuthApi extends BaseApi public function login($username, $password, $clientId, $clientSecret) { $url = $this->baseApiUrl . '/v2.1/token'; - $params = array( + $params = [ 'grant_type' => 'password', 'client_id' => $clientId, 'client_secret' => $clientSecret, 'username' => $username, 'password' => $password, - ); + ]; list($status, $result) = $this->apiPost($url, $params); if ($result) { @@ -45,10 +45,10 @@ public function login($username, $password, $clientId, $clientSecret) public function getTwitterRequestToken($clientId, $clientSecret) { $url = $this->baseApiUrl . '/v2.1/twitter/request_token'; - $params = array( + $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, - ); + ]; list ($status, $result, $headers) = $this->apiPost($url, $params); if ($status == 201) { @@ -71,12 +71,12 @@ public function getTwitterRequestToken($clientId, $clientSecret) public function verifyTwitter($clientId, $clientSecret, $token, $verifier) { $url = $this->baseApiUrl . '/v2.1/twitter/token'; - $params = array( + $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, 'token' => $token, 'verifier' => $verifier, - ); + ]; list ($status, $result, $headers) = $this->apiPost($url, $params); if ($result) { @@ -100,11 +100,11 @@ public function verifyTwitter($clientId, $clientSecret, $token, $verifier) public function verifyFacebook($clientId, $clientSecret, $code) { $url = $this->baseApiUrl . '/v2.1/facebook/token'; - $params = array( + $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, 'code' => $code, - ); + ]; list ($status, $result, $headers) = $this->apiPost($url, $params); if ($result) { diff --git a/app/src/User/NewPasswordFormType.php b/app/src/User/NewPasswordFormType.php index aa4f3254a..12b9048ee 100644 --- a/app/src/User/NewPasswordFormType.php +++ b/app/src/User/NewPasswordFormType.php @@ -39,12 +39,12 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'password', 'repeated', [ - 'type' => 'password', + 'type' => 'password', 'invalid_message' => 'The password fields must match.', - 'required' => true, - 'first_options' => array('label' => 'Password'), - 'second_options' => array('label' => 'Repeat Password'), - 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 6])], + 'required' => true, + 'first_options' => ['label' => 'Password'], + 'second_options' => ['label' => 'Repeat Password'], + 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 6])], ] ) ; diff --git a/app/src/User/RegisterFormType.php b/app/src/User/RegisterFormType.php index 7919ca06b..7f9dbccdc 100644 --- a/app/src/User/RegisterFormType.php +++ b/app/src/User/RegisterFormType.php @@ -49,8 +49,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'type' => 'password', 'invalid_message' => 'The password fields must match.', 'required' => true, - 'first_options' => array('label' => 'Password'), - 'second_options' => array('label' => 'Repeat Password'), + 'first_options' => ['label' => 'Password'], + 'second_options' => ['label' => 'Repeat Password'], 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 6])], ] ) diff --git a/app/src/User/UserApi.php b/app/src/User/UserApi.php index 0b8cff315..03d6ef314 100644 --- a/app/src/User/UserApi.php +++ b/app/src/User/UserApi.php @@ -23,7 +23,7 @@ public function __construct($config, $accessToken, UserDb $userDb) */ public function getUser($url) { - $result = $this->apiGet($url, array('verbose'=>'yes')); + $result = $this->apiGet($url, ['verbose' =>'yes']); if ($result) { $data = json_decode($result, false, 512, JSON_BIGINT_AS_STRING); @@ -99,7 +99,7 @@ public function register($data) */ public function verify($token) { - $data = array("token" => $token); + $data = ["token" => $token]; list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users/verifications', $data); @@ -121,7 +121,7 @@ public function verify($token) */ public function reverify($email) { - $data = array("email" => $email); + $data = ["email" => $email]; list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/emails/verifications', $data); @@ -201,7 +201,7 @@ public function getUsername($uri) */ public function usernameReminder($email) { - $data = array("email" => $email); + $data = ["email" => $email]; list ($status, $result, $headers) = $this->apiPost( $this->baseApiUrl . '/v2.1/emails/reminders/username', @@ -232,7 +232,7 @@ public function usernameReminder($email) */ public function passwordReset($username) { - $data = array("username" => $username); + $data = ["username" => $username]; list ($status, $result, $headers) = $this->apiPost( $this->baseApiUrl . '/v2.1/emails/reminders/password', @@ -299,10 +299,10 @@ public function delete($uri) */ public function resetPassword($token, $password) { - $data = array( - "token" => $token, + $data = [ + "token" => $token, "password" => $password, - ); + ]; list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users/passwords', $data); @@ -330,7 +330,7 @@ public function getCollection(array $queryParams = []) ); $meta = array_pop($users); - $collectionData = array(); + $collectionData = []; foreach ($users['users'] as $item) { $user = new UserEntity($item); diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index ab43ce715..25b340594 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -23,32 +23,52 @@ class UserController extends BaseController */ protected function defineRoutes(Slim $app) { - $app->get('/user/logout', array($this, 'logout'))->name('user-logout'); - $app->map('/user/login', array($this, 'login'))->via('GET', 'POST')->name('user-login'); - $app->map('/user/register', array($this, 'register'))->via('GET', 'POST')->name('user-register'); - $app->get('/user/verification', array($this, 'verification'))->name('user-verification'); - $app->map('/user/resend-verification', array($this, 'resendVerification')) - ->via('GET', 'POST')->name('user-resend-verification'); - $app->map('/user/username-reminder', array($this, 'remindUsername')) - ->via('GET', 'POST')->name('user-username-reminder'); - $app->map('/user/password-reset', array($this, 'resetPassword')) - ->via('GET', 'POST')->name('user-password-reset'); - $app->map('/user/new-password', array($this, 'newPassword')) - ->via('GET', 'POST')->name('user-new-password'); - $app->get('/user/twitter-login', array($this, 'loginWithTwitter'))->name('twitter-login'); - $app->get('/user/twitter-access', array($this, 'accessTokenFromTwitter'))->name('twitter-callback'); - $app->get('/user/facebook-access', array($this, 'accessTokenFromFacebook'))->name('facebook-callback'); - $app->get('/user/:username', array($this, 'profile'))->name('user-profile'); - $app->get('/user/:username/talks', array($this, 'profileTalks'))->name('user-profile-talks'); - $app->get('/user/:username/events', array($this, 'profileEvents'))->name('user-profile-events'); - $app->get('/user/:username/hosted', array($this, 'profileHosted'))->name('user-profile-hosted'); - $app->get('/user/:username/comments', array($this, 'profileComments'))->name('user-profile-comments'); - $app->map('/user/:username/edit', array($this, 'profileEdit')) - ->via('GET', 'POST')->name('user-profile-edit'); - $app->get('/user/:username/delete', array($this, 'userDelete'))->name('user-profile-delete'); - $app->get('/user/view/:userId(/:extra+)', array($this, 'redirectFromId')) + $app->get('/user/logout', [$this, 'logout']) + ->name('user-logout'); + $app->map('/user/login', [$this, 'login']) + ->via('GET', 'POST') + ->name('user-login'); + $app->map('/user/register', [$this, 'register']) + ->via('GET', 'POST') + ->name('user-register'); + $app->get('/user/verification', [$this, 'verification']) + ->name('user-verification'); + $app->map('/user/resend-verification', [$this, 'resendVerification']) + ->via('GET', 'POST') + ->name('user-resend-verification'); + $app->map('/user/username-reminder', [$this, 'remindUsername']) + ->via('GET', 'POST') + ->name('user-username-reminder'); + $app->map('/user/password-reset', [$this, 'resetPassword']) + ->via('GET', 'POST') + ->name('user-password-reset'); + $app->map('/user/new-password', [$this, 'newPassword']) + ->via('GET', 'POST') + ->name('user-new-password'); + $app->get('/user/twitter-login', [$this, 'loginWithTwitter']) + ->name('twitter-login'); + $app->get('/user/twitter-access', [$this, 'accessTokenFromTwitter']) + ->name('twitter-callback'); + $app->get('/user/facebook-access', [$this, 'accessTokenFromFacebook']) + ->name('facebook-callback'); + $app->get('/user/:username', [$this, 'profile']) + ->name('user-profile'); + $app->get('/user/:username/talks', [$this, 'profileTalks']) + ->name('user-profile-talks'); + $app->get('/user/:username/events', [$this, 'profileEvents']) + ->name('user-profile-events'); + $app->get('/user/:username/hosted', [$this, 'profileHosted']) + ->name('user-profile-hosted'); + $app->get('/user/:username/comments', [$this, 'profileComments']) + ->name('user-profile-comments'); + $app->map('/user/:username/edit', [$this, 'profileEdit']) + ->via('GET', 'POST') + ->name('user-profile-edit'); + $app->get('/user/:username/delete', [$this, 'userDelete']) + ->name('user-profile-delete'); + $app->get('/user/view/:userId(/:extra+)', [$this, 'redirectFromId']) ->name('user-redirect-from-id') - ->conditions(array('userId' => '\d+')); + ->conditions(['userId' => '\d+']); } /** @@ -112,9 +132,9 @@ public function register() $this->render( 'User/register.html.twig', - array( + [ 'form' => $form->createView(), - ) + ] ); } @@ -223,9 +243,9 @@ public function resendVerification() $this->render( 'User/emailverification.html.twig', - array( + [ 'form' => $form->createView(), - ) + ] ); } @@ -247,8 +267,8 @@ public function profile($username) $talkApi = $this->getTalkApi(); $eventApi = $this->getEventApi(); - $eventInfo = array(); // look up an event's name and url_friendly_name from its uri - $talkInfo = array(); // look up a talk's url_friendly_talk_title from its uri + $eventInfo = []; // look up an event's name and url_friendly_name from its uri + $talkInfo = []; // look up a talk's url_friendly_talk_title from its uri $talkCollection = $talkApi->getCollection($user->getTalksUri(), ['verbose' => 'yes', 'resultsperpage' => 5]); $talks = false; @@ -305,7 +325,7 @@ public function profile($username) echo $this->render( 'User/profile.html.twig', - array( + [ 'thisUser' => $user, 'talks' => $talks, 'eventInfo' => $eventInfo, @@ -313,7 +333,7 @@ public function profile($username) 'events' => $events, 'hostedEvents' => $hostedEvents, 'talkComments' => $talkComments, - ) + ] ); } @@ -338,7 +358,7 @@ public function profileTalks($username) $this->application->redirect($this->application->urlFor('user-profile', ['username' => $username])); } - $eventInfo = array(); + $eventInfo = []; if (isset($talkCollection['talks'])) { $talks = $talkCollection['talks']; foreach ($talks as $talk) { @@ -351,11 +371,11 @@ public function profileTalks($username) echo $this->render( 'User/profile-talks.html.twig', - array( + [ 'thisUser' => $user, 'talks' => $talks, 'eventInfo' => $eventInfo, - ) + ] ); } @@ -384,11 +404,11 @@ public function profileEvents($username) echo $this->render( 'User/profile-events.html.twig', - array( + [ 'thisUser' => $user, 'events' => $eventsCollection['events'], 'type' => 'attended', - ) + ] ); } @@ -418,11 +438,11 @@ public function profileHosted($username) echo $this->render( 'User/profile-events.html.twig', - array( + [ 'thisUser' => $user, 'events' => $hostedEventsCollection['events'], 'type' => 'hosted', - ) + ] ); } @@ -448,8 +468,8 @@ public function profileComments($username) $this->application->redirect($this->application->urlFor('user-profile', ['username' => $username])); } - $talkInfo = array(); - $eventInfo = array(); + $talkInfo = []; + $eventInfo = []; foreach ($talkComments as $comment) { if (isset($talkInfo[$comment->getTalkUri()])) { continue; @@ -474,12 +494,12 @@ public function profileComments($username) $this->render( 'User/profile-comments.html.twig', - array( + [ 'thisUser' => $user, 'talkComments' => $talkComments, 'eventInfo' => $eventInfo, 'talkInfo' => $talkInfo, - ) + ] ); } @@ -488,7 +508,7 @@ protected function lookupEventInfo($eventUri) $eventDb = $this->getEventDb(); $eventApi = $this->getEventApi(); - $eventInfo = array(); + $eventInfo = []; $eventData = $eventDb->load('uri', $eventUri); if (isset($eventData['name'])) { $eventInfo['url_friendly_name'] = $eventData['url_friendly_name']; @@ -580,9 +600,9 @@ public function remindUsername() $this->render( 'User/username-reminder.html.twig', - array( + [ 'form' => $form->createView(), - ) + ] ); } @@ -668,11 +688,11 @@ public function profileEdit($username) $this->render( 'User/profile-edit.html.twig', - array( + [ 'thisUser' => $user, 'form' => $form->createView(), 'can_change_password' => $canChangePassword, - ) + ] ); } @@ -732,9 +752,9 @@ public function resetPassword() $this->render( 'User/password-reset.html.twig', - array( + [ 'form' => $form->createView(), - ) + ] ); } @@ -778,9 +798,9 @@ public function newPassword() $this->render( 'User/new-password.html.twig', - array( + [ 'form' => $form->createView(), - ) + ] ); } @@ -911,7 +931,7 @@ public function redirectFromId($userId) $this->application->redirect( $this->application->urlFor( 'user-profile', - array('username' => $user->getUsername()) + ['username' => $user->getUsername()] ) ); } diff --git a/app/src/User/UserDb.php b/app/src/User/UserDb.php index 600179709..49572fb1b 100644 --- a/app/src/User/UserDb.php +++ b/app/src/User/UserDb.php @@ -14,12 +14,12 @@ public function __construct(CacheService $cache) public function save(UserEntity $user) { - $data = array( + $data = [ 'uri' => $user->getUri(), 'username' => $user->getUsername(), 'slug' => $user->getUsername(), 'verbose_uri' => $user->getVerboseUri() - ); + ]; $savedUser = $this->load('uri', $user->getUri()); if ($savedUser) { diff --git a/app/src/User/UserFormType.php b/app/src/User/UserFormType.php index 4e77e1d82..32d505ded 100644 --- a/app/src/User/UserFormType.php +++ b/app/src/User/UserFormType.php @@ -98,8 +98,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'type' => 'password', 'invalid_message' => 'The password fields must match.', 'required' => false, - 'first_options' => array('label' => 'New password'), - 'second_options' => array('label' => 'Repeat new password'), + 'first_options' => ['label' => 'New password'], + 'second_options' => ['label' => 'Repeat new password'], 'constraints' => [new Assert\Length(['min' => 6])], ] ); diff --git a/app/src/View/FunctionsExtension.php b/app/src/View/FunctionsExtension.php index 41fc624ec..64bc4723e 100644 --- a/app/src/View/FunctionsExtension.php +++ b/app/src/View/FunctionsExtension.php @@ -29,7 +29,7 @@ public function getFunctions() $app = $this->app; return [ - new TwigFunction('urlFor', function ($routeName, $params = array()) use ($app) { + new TwigFunction('urlFor', function ($routeName, $params = []) use ($app) { $url = rtrim($app->urlFor($routeName, $params), '/'); return $url; @@ -67,22 +67,22 @@ public function getFunctions() return $url; }), - new TwigFunction('urlForTalk', function ($eventSlug, $talkSlug, $params = array()) use ($app) { - return $app->urlFor('talk', array('eventSlug' => $eventSlug, 'talkSlug' => $talkSlug)); + new TwigFunction('urlForTalk', function ($eventSlug, $talkSlug, $params = []) use ($app) { + return $app->urlFor('talk', ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); }), new TwigFunction('shortUrlForTalk', function ($talkStub) use ($app) { $scheme = $app->request()->getScheme(); $host = $app->request()->headers('host'); - return "$scheme://$host" . $app->urlFor('talk-quicklink', array('talkStub' => $talkStub)); + return "$scheme://$host" . $app->urlFor('talk-quicklink', ['talkStub' => $talkStub]); }), new TwigFunction('shortUrlForEvent', function ($eventStub) use ($app) { $scheme = $app->request()->getScheme(); $host = $app->request()->headers('host'); - return "$scheme://$host" . $app->urlFor('event-quicklink', array('stub' => $eventStub)); + return "$scheme://$host" . $app->urlFor('event-quicklink', ['stub' => $eventStub]); }), new TwigFunction( From bae2f16273b0518fa02d93a95ad3fb6994e58a99 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 22:45:39 +0200 Subject: [PATCH 39/56] apply codestyle fixes --- app/src/Application/BaseApi.php | 16 +- app/src/Application/ContactApi.php | 2 +- app/src/Client/ClientController.php | 36 ++-- app/src/Client/ClientFormType.php | 2 +- .../Constraint/ValidEventIconValidator.php | 6 +- app/src/Event/EventApi.php | 51 +++-- app/src/Event/EventController.php | 190 ++++++++++-------- app/src/Event/EventEntity.php | 2 +- app/src/Event/EventFormType.php | 26 +-- app/src/Event/EventScheduler.php | 4 +- app/src/Event/TrackApi.php | 10 +- app/src/Event/TrackFormType.php | 2 +- app/src/Language/LanguageApi.php | 1 + app/src/Middleware/FormMiddleware.php | 3 +- app/src/Search/SearchController.php | 42 ++-- app/src/Talk/SpeakerFormType.php | 7 +- app/src/Talk/TalkApi.php | 46 ++--- app/src/Talk/TalkCommentEntity.php | 1 - app/src/Talk/TalkController.php | 104 +++++----- app/src/Talk/TalkEntity.php | 2 +- app/src/Talk/TalkFormType.php | 65 +++--- app/src/Talk/TalkMediaFormType.php | 2 +- app/src/Talk/TalkTypeApi.php | 2 +- app/src/User/AuthApi.php | 8 +- app/src/User/EmailInputFormType.php | 2 +- app/src/User/RegisterFormType.php | 20 +- app/src/User/UserApi.php | 22 +- app/src/User/UserController.php | 104 +++++----- app/src/User/UserDb.php | 8 +- app/src/User/UserEntity.php | 2 +- app/src/User/UserFormType.php | 24 +-- app/src/User/UsernameInputFormType.php | 2 +- tests/Event/EventApiTest.php | 126 ++++++------ tests/Event/EventCommentEntityTest.php | 2 +- tests/Event/EventEntityTest.php | 44 ++-- tests/Event/EventFormTypeTest.php | 30 +-- tests/Middleware/FormMiddlewareTest.php | 2 +- web/index.php | 12 +- 38 files changed, 532 insertions(+), 498 deletions(-) diff --git a/app/src/Application/BaseApi.php b/app/src/Application/BaseApi.php index f70954edb..61925888e 100644 --- a/app/src/Application/BaseApi.php +++ b/app/src/Application/BaseApi.php @@ -45,12 +45,12 @@ protected function apiGet($url, $params = []) } if ($this->proxy) { - $contextOpts['http']['proxy'] = $this->proxy; + $contextOpts['http']['proxy'] = $this->proxy; $contextOpts['http']['request_fulluri'] = true; } $streamContext = stream_context_create($contextOpts); - $result = file_get_contents($url . $paramsString, 0, $streamContext); + $result = file_get_contents($url . $paramsString, 0, $streamContext); if (false === $result) { throw new Exception('Unable to connect to API'); @@ -73,7 +73,7 @@ protected function apiDelete($url, $params = []) ]; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $_SERVER['REMOTE_ADDR']; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; $contextOpts['http']['header'] .= "\r\nForwarded: for=$ip;user-agent=\"$agent\""; @@ -82,12 +82,12 @@ protected function apiDelete($url, $params = []) } if ($this->proxy) { - $contextOpts['http']['proxy'] = $this->proxy; + $contextOpts['http']['proxy'] = $this->proxy; $contextOpts['http']['request_fulluri'] = true; } $streamContext = stream_context_create($contextOpts); - $result = file_get_contents($url . $paramsString, 0, $streamContext); + $result = file_get_contents($url . $paramsString, 0, $streamContext); if (false === $result) { throw new Exception('Unable to connect to API'); @@ -117,7 +117,7 @@ protected function apiPost($url, $params = []) ]; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) - $ip = $_SERVER['REMOTE_ADDR']; + $ip = $_SERVER['REMOTE_ADDR']; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; $contextOpts['http']['header'] .= "\r\nForwarded: for=$ip;user-agent=\"$agent\""; @@ -126,12 +126,12 @@ protected function apiPost($url, $params = []) } if ($this->proxy) { - $contextOpts['http']['proxy'] = $this->proxy; + $contextOpts['http']['proxy'] = $this->proxy; $contextOpts['http']['request_fulluri'] = true; } $streamContext = stream_context_create($contextOpts); - $result = file_get_contents($url, 0, $streamContext); + $result = file_get_contents($url, 0, $streamContext); if (false === $result) { throw new Exception('Unable to connect to API'); } diff --git a/app/src/Application/ContactApi.php b/app/src/Application/ContactApi.php index 92d6d802c..d44faa1c3 100644 --- a/app/src/Application/ContactApi.php +++ b/app/src/Application/ContactApi.php @@ -22,7 +22,7 @@ public function contact($name, $email, $subject, $comment, $clientId, $clientSec return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new \Exception("Failed: " . $message); diff --git a/app/src/Client/ClientController.php b/app/src/Client/ClientController.php index 229f56eec..cfcc89676 100644 --- a/app/src/Client/ClientController.php +++ b/app/src/Client/ClientController.php @@ -12,11 +12,19 @@ class ClientController extends BaseController { protected function defineRoutes(Slim $app) { - $app->get('/user/:username/client', [$this, 'index'])->name('clients'); - $app->map('/user/:username/client/create', [$this, 'createClient'])->via('GET', 'POST')->name('client-create'); - $app->get('/user/:username/client/:clientName', [$this, 'showClient'])->name('client-show'); - $app->map('/user/:username/client/:clientName/edit', [$this, 'editClient'])->via('GET', 'POST')->name('client-edit'); - $app->get('/user/:username/client/:clientName/delete', [$this, 'deleteClient'])->via('GET', 'POST')->name('client-delete'); + $app->get('/user/:username/client', [$this, 'index']) + ->name('clients'); + $app->map('/user/:username/client/create', [$this, 'createClient']) + ->via('GET', 'POST') + ->name('client-create'); + $app->get('/user/:username/client/:clientName', [$this, 'showClient']) + ->name('client-show'); + $app->map('/user/:username/client/:clientName/edit', [$this, 'editClient']) + ->via('GET', 'POST') + ->name('client-edit'); + $app->get('/user/:username/client/:clientName/delete', [$this, 'deleteClient']) + ->via('GET', 'POST') + ->name('client-delete'); } public function index($username) @@ -37,7 +45,7 @@ public function index($username) } $clientApi = $this->getClientApi(); - $clients = $clientApi->getCollection([]); + $clients = $clientApi->getCollection([]); $this->render('Client/index.html.twig', [ 'clients' => $clients['clients'], @@ -153,14 +161,15 @@ public function editClient($username, $clientName) } // default values - $data = []; - $data['application'] = $client->getName(); - $data['description'] = $client->getDescription(); - $data['callback_url'] = $client->getCallbackUrl(); + $data = [ + 'application' => $client->getName(), + 'description' => $client->getDescription(), + 'callback_url' => $client->getCallbackUrl() + ]; /** @var FormFactoryInterface $factory */ $factory = $this->application->formFactory; - $form = $factory->create(new ClientFormType(), $data); + $form = $factory->create(new ClientFormType(), $data); $request = $this->application->request(); if ($request->isPost()) { @@ -259,11 +268,10 @@ public function deleteClient($username, $clientName) } // default values - $data = []; - $data['client_id'] = $client->getId(); + $data = ['client_id' => $client->getId()]; $factory = $this->application->formFactory; - $form = $factory->create(new ClientDeleteFormType(), $data); + $form = $factory->create(new ClientDeleteFormType(), $data); $request = $this->application->request(); diff --git a/app/src/Client/ClientFormType.php b/app/src/Client/ClientFormType.php index fb066978b..34b96fd2a 100644 --- a/app/src/Client/ClientFormType.php +++ b/app/src/Client/ClientFormType.php @@ -46,7 +46,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'textarea', [ 'constraints' => [new Assert\NotBlank()], - 'attr'=> ['rows' => '10'] + 'attr' => ['rows' => '10'] ] ) ->add( diff --git a/app/src/Event/Constraint/ValidEventIconValidator.php b/app/src/Event/Constraint/ValidEventIconValidator.php index 2c3085bab..63b806a44 100644 --- a/app/src/Event/Constraint/ValidEventIconValidator.php +++ b/app/src/Event/Constraint/ValidEventIconValidator.php @@ -12,7 +12,7 @@ class ValidEventIconValidator extends ConstraintValidator public function validate($value, Constraint $constraint) { $groupName = $constraint->groupname; - $keyName = $constraint->keyname; + $keyName = $constraint->keyname; $files = $_FILES; if ($groupName) { @@ -27,7 +27,7 @@ public function validate($value, Constraint $constraint) $filename = $files['name'][$keyName]; // we have a file - is it valid? $contents = file_get_contents($files['tmp_name'][$keyName]); - $image = @imagecreatefromstring($contents); + $image = @imagecreatefromstring($contents); if ($image === false) { $this->context->buildViolation("'%filename%' is not a recognised image file") ->setParameter('%filename%', $filename) @@ -35,7 +35,7 @@ public function validate($value, Constraint $constraint) return; } - $width = imagesx($image); + $width = imagesx($image); $height = imagesy($image); if ($width !== $height) { imagedestroy($image); diff --git a/app/src/Event/EventApi.php b/app/src/Event/EventApi.php index 80cb78c88..d52b119f8 100644 --- a/app/src/Event/EventApi.php +++ b/app/src/Event/EventApi.php @@ -1,6 +1,9 @@ getCommentsUri(); + $uri = $event->getCommentsUri(); $params = [ 'comment' => $comment, - 'rating' => $rating, + 'rating' => $rating, ]; - list ($status, $result) = $this->apiPost($uri, $params); + list($status, $result) = $this->apiPost($uri, $params); if ($status == 201) { return true; @@ -182,7 +185,7 @@ public function addComment(EventEntity $event, $comment, $rating = 0) public function reportComment($uri) { - list ($status, $result) = $this->apiPost($uri); + list($status, $result) = $this->apiPost($uri); if ($status == 202) { return true; @@ -192,7 +195,7 @@ public function reportComment($uri) public function attend(EventEntity $event) { - list ($status, $result) = $this->apiPost($event->getApiUriToMarkAsAttending()); + list($status, $result) = $this->apiPost($event->getApiUriToMarkAsAttending()); if ($status == 201) { return true; @@ -203,7 +206,7 @@ public function attend(EventEntity $event) public function unattend(EventEntity $event) { - list ($status, $result) = $this->apiDelete($event->getApiUriToMarkAsAttending()); + list($status, $result) = $this->apiDelete($event->getApiUriToMarkAsAttending()); if ($status == 200) { return true; @@ -222,13 +225,11 @@ public function unattend(EventEntity $event) */ public function getAttendees($attendees_uri, $limit = 0, $verbose = false) { - $attendees_uri .= "?resultsperpage={$limit}"; if ($verbose) { $attendees_uri = $attendees_uri . '&verbose=yes'; } - $attendees = (array)json_decode($this->apiGet($attendees_uri)); $attendeeData = []; @@ -267,7 +268,7 @@ public function submit(array $data) } } - list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/events', $data); + list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/events', $data); // if successful, return event entity represented by the URL in the Location header if ($status == 201) { @@ -314,7 +315,7 @@ public function edit(array $data) } - list ($status, $result, $headers) = $this->apiPut($data['uri'], $data); + list($status, $result, $headers) = $this->apiPut($data['uri'], $data); // if successful, return event entity represented by the URL in the Location header if ($status == 204) { $response = $this->getCollection($headers['location']); @@ -336,20 +337,22 @@ public function edit(array $data) public function uploadIcon($imagesUri, $fileName) { try { - $client = new \GuzzleHttp\Client([ + $client = new Client([ "timeout" => 10, ]); $headers = []; - $headers["Accept"] = "application/json"; + + $headers["Accept"] = "application/json"; $headers["Authorization"] = "OAuth {$this->accessToken}"; // Forwarded header - see RFC 7239 (http://tools.ietf.org/html/rfc7239) - $ip = $_SERVER['REMOTE_ADDR']; - $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; + $ip = $_SERVER['REMOTE_ADDR']; + $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown'; $headers["Forwarded"] = "for=$ip;user-agent=\"$agent\""; $options = []; + $options['headers'] = $headers; if ($this->proxy) { @@ -357,12 +360,16 @@ public function uploadIcon($imagesUri, $fileName) } // now add the file itself - $options['multipart'] = [['name' => 'image', - 'contents' => fopen($fileName, 'r')]]; - - $request = new \GuzzleHttp\Psr7\Request('POST', $imagesUri); + $options['multipart'] = [ + [ + 'name' => 'image', + 'contents' => fopen($fileName, 'r') + ] + ]; + + $request = new Request('POST', $imagesUri); $response = $client->send($request, $options); - } catch (\GuzzleHttp\Exception\RequestException $e) { + } catch (RequestException $e) { $body = $e->getResponse()->getBody(); error_log($e->getMessage()); error_log(json_decode($body)[0]); @@ -460,7 +467,7 @@ public function getTalkComments($comment_uri, $limit = 10, $start = 1, $verbose */ public function approveEvent($approval_uri) { - list ($status, $result, $headers) = $this->apiPost($approval_uri); + list($status, $result, $headers) = $this->apiPost($approval_uri); if ($status == 204) { return true; @@ -476,7 +483,7 @@ public function approveEvent($approval_uri) */ public function rejectEvent($approval_uri) { - list ($status, $result, $headers) = $this->apiDelete($approval_uri); + list($status, $result, $headers) = $this->apiDelete($approval_uri); if ($status == 204) { return true; @@ -539,7 +546,7 @@ public function moderateComment($reported_uri, $decision) { $data['decision'] = $decision; - list ($status, $result, $headers) = $this->apiPut($reported_uri, $data); + list($status, $result, $headers) = $this->apiPut($reported_uri, $data); // if successful, return event entity represented by the URL in the Location header if ($status == 204) { diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index c61cd53ed..e7a48ef57 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -27,35 +27,55 @@ class EventController extends BaseController public function __construct(Slim $app) { parent::__construct($app); - $this->itemsPerPage = 10; + $this->itemsPerPage = 10; $this->pendingItemsPerPage = 30; } protected function defineRoutes(Slim $app) { // named routes first; should an event pick the same name then at least our actions take precedence - $app->get('/event', [$this, 'index'])->name("events-index"); - $app->get('/event/pending', [$this, 'pending'])->name("events-pending"); - $app->map('/event/submit', [$this, 'submit'])->via('GET', 'POST')->name('event-submit'); - $app->get('/event/callforpapers', [$this, 'callForPapers'])->name('event-call-for-papers'); - $app->get('/event/:friendly_name', [$this, 'eventDefault'])->name("event-default"); - $app->get('/event/:friendly_name/details', [$this, 'details'])->name("event-detail"); - $app->get('/event/:friendly_name/attendees', [$this, 'attendees'])->name("event-attendees"); - $app->get('/event/:friendly_name/slides', [$this, 'slides'])->name("event-slides"); - $app->get('/event/:friendly_name/comments', [$this, 'comments'])->name("event-comments"); + $app->get('/event', [$this, 'index']) + ->name("events-index"); + $app->get('/event/pending', [$this, 'pending']) + ->name("events-pending"); + $app->map('/event/submit', [$this, 'submit']) + ->via('GET', 'POST') + ->name('event-submit'); + $app->get('/event/callforpapers', [$this, 'callForPapers']) + ->name('event-call-for-papers'); + $app->get('/event/:friendly_name', [$this, 'eventDefault']) + ->name("event-default"); + $app->get('/event/:friendly_name/details', [$this, 'details']) + ->name("event-detail"); + $app->get('/event/:friendly_name/attendees', [$this, 'attendees']) + ->name("event-attendees"); + $app->get('/event/:friendly_name/slides', [$this, 'slides']) + ->name("event-slides"); + $app->get('/event/:friendly_name/comments', [$this, 'comments']) + ->name("event-comments"); $app->get('/event/:friendly_name/comments/:comment_hash/report', [$this, 'reportComment']) ->name("event-comments-reported"); - $app->get('/event/:friendly_name/schedule', [$this, 'schedule'])->name("event-schedule"); - $app->get('/event/:friendly_name/schedule/list(/:starred)', [$this, 'scheduleList'])->name("event-schedule-list"); - $app->get('/event/:friendly_name/schedule/grid(/:starred)', [$this, 'scheduleGrid'])->name("event-schedule-grid"); - $app->get('/event/:friendly_name/talk-comments', [$this, 'talkComments'])->name("event-talk-comments"); - $app->post('/event/:friendly_name/add-comment', [$this, 'addComment'])->name('event-add-comment'); - $app->map('/event/:friendly_name/edit', [$this, 'edit'])->via('GET', 'POST')->name('event-edit'); - $app->get('/e/:stub', [$this, 'quicklink'])->name("event-quicklink"); + $app->get('/event/:friendly_name/schedule', [$this, 'schedule']) + ->name("event-schedule"); + $app->get('/event/:friendly_name/schedule/list(/:starred)', [$this, 'scheduleList']) + ->name("event-schedule-list"); + $app->get('/event/:friendly_name/schedule/grid(/:starred)', [$this, 'scheduleGrid']) + ->name("event-schedule-grid"); + $app->get('/event/:friendly_name/talk-comments', [$this, 'talkComments']) + ->name("event-talk-comments"); + $app->post('/event/:friendly_name/add-comment', [$this, 'addComment']) + ->name('event-add-comment'); + $app->map('/event/:friendly_name/edit', [$this, 'edit']) + ->via('GET', 'POST') + ->name('event-edit'); + $app->get('/e/:stub', [$this, 'quicklink']) + ->name("event-quicklink"); $app->get('/event/xhr-attend/:friendly_name', [$this, 'xhrAttend']); $app->get('/event/xhr-unattend/:friendly_name', [$this, 'xhrUnattend']); - $app->get('/event/attend/:friendly_name', [$this, 'attend'])->name("event-attend"); - $app->get('/event/unattend/:friendly_name', [$this, 'unattend'])->name("event-unattend"); + $app->get('/event/attend/:friendly_name', [$this, 'attend']) + ->name("event-attend"); + $app->get('/event/unattend/:friendly_name', [$this, 'unattend']) + ->name("event-unattend"); $app->post('/event/action-pending-event/:friendly_name', [$this, 'actionPendingEvent']) ->name("event-action-pending"); $app->get('/event/view/:eventId(/:extra+)', [$this, 'redirectFromId']) @@ -65,18 +85,21 @@ protected function defineRoutes(Slim $app) ->name("event-reported-comments"); $app->post('/event/:friendly_name/moderate-comment', [$this, 'moderateComment']) ->name("event-moderate-comment"); - $app->map('/event/:friendly_name/add-talk', [$this, 'addTalk'])->via('GET', 'POST') + $app->map('/event/:friendly_name/add-talk', [$this, 'addTalk']) + ->via('GET', 'POST') ->name("event-add-talk"); - $app->map('/event/:friendly_name/edit-tracks', [$this, 'editTracks'])->via('GET', 'POST') + $app->map('/event/:friendly_name/edit-tracks', [$this, 'editTracks']) + ->via('GET', 'POST') ->name("event-edit-tracks"); - $app->map('/event/:friendly_name/claims', [$this, 'talkClaims'])->via('GET', 'POST') + $app->map('/event/:friendly_name/claims', [$this, 'talkClaims']) + ->via('GET', 'POST') ->name("event-talk-claims"); } public function index() { $start = null; - $page = (int)$this->application->request()->get('page'); + $page = (int)$this->application->request()->get('page'); if (array_key_exists('events_list_middle_start', $_SESSION) && $page !== 0) { // use the middle start point that we've remembered, unless it's page zero, @@ -85,12 +108,12 @@ public function index() if ($start < 0) { $this->itemsPerPage = $start + $this->itemsPerPage; - $start = 0; + $start = 0; } } $eventApi = $this->getEventApi(); - $events = $eventApi->getEvents($this->itemsPerPage, $start, 'all'); + $events = $eventApi->getEvents($this->itemsPerPage, $start, 'all'); if ($start === null) { // Find out the start number that has been sent back to us by the API if (isset($events['pagination'])) { @@ -107,9 +130,9 @@ public function index() $this->render( 'Event/index.html.twig', [ - 'page' => $page, + 'page' => $page, 'cfp_events' => $cfpEvents, - 'events' => $events + 'events' => $events ] ); } @@ -128,7 +151,7 @@ public function pending() $start = ($page -1) * $this->pendingItemsPerPage; $eventApi = $this->getEventApi(); - $events = $eventApi->getEvents( + $events = $eventApi->getEvents( $this->pendingItemsPerPage, $start, 'pending', @@ -138,7 +161,7 @@ public function pending() $this->render( 'Event/pending.html.twig', [ - 'page' => $page, + 'page' => $page, 'events' => $events ] ); @@ -152,7 +175,7 @@ public function callForPapers() $start = ($page -1) * $this->itemsPerPage; $eventApi = $this->getEventApi(); - $events = $eventApi->getEvents( + $events = $eventApi->getEvents( $this->itemsPerPage, $start, 'cfp', @@ -162,7 +185,7 @@ public function callForPapers() $this->render( 'Event/call-for-papers.html.twig', [ - 'page' => $page, + 'page' => $page, 'events' => $events, ] ); @@ -217,7 +240,7 @@ public function details($friendly_name) $this->render( 'Event/details.html.twig', [ - 'event' => $event, + 'event' => $event, 'quicklink' => $quicklink, 'attendees' => $attendees ] @@ -295,10 +318,10 @@ public function talkComments($friendly_name) $this->render( 'Event/talk-comments.html.twig', [ - 'event' => $event, - 'page' => $page, + 'event' => $event, + 'page' => $page, 'talkComments' => $comments, - 'talkSlugs' => $slugs, + 'talkSlugs' => $slugs, ] ); } else { @@ -332,7 +355,7 @@ public function slides($friendly_name) $agenda = $this->getTalkApi()->getAgenda($event->getTalksUri()); $this->render('Event/slides.html.twig', [ - 'event' => $event, + 'event' => $event, 'agenda' => $agenda, ]); } @@ -340,7 +363,7 @@ public function slides($friendly_name) public function scheduleList($friendly_name, $starred = false) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if (! $event) { $this->redirectToListPage(); @@ -350,8 +373,8 @@ public function scheduleList($friendly_name, $starred = false) $agenda = $this->getTalkApi()->getAgenda($event->getTalksUri()); - $request = $this->application->request(); - $starredOnly = ($starred === 'starred'); + $request = $this->application->request(); + $starredOnly = ($starred === 'starred'); $currentUrlWithoutStarred = str_replace('/starred', '', $request->getResourceUri()); @@ -373,7 +396,7 @@ public function scheduleList($friendly_name, $starred = false) public function scheduleGrid($friendly_name, $starred = false) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if (! $event) { $this->redirectToListPage(); @@ -381,13 +404,13 @@ public function scheduleGrid($friendly_name, $starred = false) setcookie('schedule-view', 'grid', strtotime('+2 years'), '/'); - $talkApi = $this->getTalkApi(); + $talkApi = $this->getTalkApi(); $scheduler = new EventScheduler($talkApi); $schedule = $scheduler->getScheduleData($event); - $request = $this->application->request(); - $starredOnly = ($starred === 'starred'); + $request = $this->application->request(); + $starredOnly = ($starred === 'starred'); $currentUrlWithoutStarred = str_replace('/starred', '', $request->getResourceUri()); // Does it end in /schedule/grid or are we on the default event page @@ -408,7 +431,7 @@ public function scheduleGrid($friendly_name, $starred = false) public function quicklink($stub) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByStub($stub); + $event = $eventApi->getByStub($stub); if (! $event) { $this->redirectToListPage(); } @@ -420,12 +443,12 @@ public function addComment($friendly_name) { $request = $this->application->request(); $comment = $request->post('comment'); - $rating = (int) $request->post('rating'); - $url = $this->application->urlFor("event-comments", ['friendly_name' => $friendly_name]); - $url .= '#add-comment'; + $rating = (int)$request->post('rating'); + $url = $this->application->urlFor("event-comments", ['friendly_name' => $friendly_name]); + $url .= '#add-comment'; $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { try { $eventApi->addComment($event, $comment, $rating); @@ -456,8 +479,8 @@ public function addComment($friendly_name) public function reportComment($friendly_name, $comment_hash) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); - $url = $this->application->urlFor("event-comments", ['friendly_name' => $friendly_name]); + $event = $eventApi->getByFriendlyUrl($friendly_name); + $url = $this->application->urlFor("event-comments", ['friendly_name' => $friendly_name]); $comments = $eventApi->getComments($event->getCommentsUri()); foreach ($comments as $comment) { @@ -487,7 +510,7 @@ public function reportComment($friendly_name, $comment_hash) public function attend($friendly_name) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { $eventApi->attend($event, $_SESSION['user']); @@ -504,7 +527,7 @@ public function attend($friendly_name) public function unattend($friendly_name) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { $eventApi->unattend($event, $_SESSION['user']); @@ -651,7 +674,7 @@ public function actionPendingEvent($friendly_name) public function redirectFromId($eventId, $extra = false) { $eventApi = $this->getEventApi(); - $event = $eventApi->getEventById($eventId); + $event = $eventApi->getEventById($eventId); if (!$event) { return Slim::getInstance()->notFound(); } @@ -663,14 +686,18 @@ public function redirectFromId($eventId, $extra = false) ['friendly_name' => $event->getUrlFriendlyName()] ) ); - } if ($extra && is_array($extra) && ($extra[0] == "comments")) { + } + + if ($extra && is_array($extra) && ($extra[0] == "comments")) { $this->application->redirect( $this->application->urlFor( 'event-comments', ['friendly_name' => $event->getUrlFriendlyName()] ) ); - } if ($extra && is_array($extra) && ($extra[0] == "talks")) { + } + + if ($extra && is_array($extra) && ($extra[0] == "talks")) { $this->application->redirect( $this->application->urlFor( 'event-schedule', @@ -700,7 +727,7 @@ public function redirectFromId($eventId, $extra = false) private function addEventUsingForm(FormInterface $form) { $eventApi = $this->getEventApi(); - $values = $form->getData(); + $values = $form->getData(); $result = false; try { @@ -727,7 +754,7 @@ private function addEventUsingForm(FormInterface $form) private function editEventUsingForm(FormInterface $form) { $eventApi = $this->getEventApi(); - $values = $form->getData()->toArray(); + $values = $form->getData()->toArray(); $result = false; try { @@ -747,8 +774,8 @@ private function editEventUsingForm(FormInterface $form) ); } } catch (\Exception $e) { - $result = false; - $error = $e->getMessage(); + $result = false; + $error = $e->getMessage(); $messages = json_decode($error); if ($messages) { $error = implode(', ', $messages); @@ -763,8 +790,8 @@ private function editEventUsingForm(FormInterface $form) protected function getEventApi() { - $cache = $this->getCache(); - $eventDb = new EventDb($cache); + $cache = $this->getCache(); + $eventDb = new EventDb($cache); $eventApi = new EventApi($this->cfg, $this->accessToken, $eventDb, $this->getUserApi()); return $eventApi; @@ -823,7 +850,7 @@ public function xhrAttend($friendly_name) { $this->application->response()->header('Content-Type', 'application/json'); - $api = $this->getEventApi(); + $api = $this->getEventApi(); $event = $api->getByFriendlyUrl($friendly_name); if ($event) { @@ -837,7 +864,7 @@ public function xhrUnattend($friendly_name) { $this->application->response()->header('Content-Type', 'application/json'); - $api = $this->getEventApi(); + $api = $this->getEventApi(); $event = $api->getByFriendlyUrl($friendly_name); if ($event) { @@ -850,7 +877,7 @@ public function xhrUnattend($friendly_name) public function reportedComments($friendly_name) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { if (! $event->getCanEdit()) { @@ -868,7 +895,7 @@ public function reportedComments($friendly_name) $this->render( 'Event/reported-comments.html.twig', [ - 'event' => $event, + 'event' => $event, 'eventComments' => $eventComments, 'talkComments' => $talkComments, ] @@ -896,7 +923,7 @@ public function moderateComment($friendly_name) } $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { if (! $event->getCanEdit()) { @@ -925,9 +952,8 @@ public function talkClaims($friendly_name) ); } - $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { if (!$event->getCanEdit()) { @@ -944,7 +970,7 @@ public function talkClaims($friendly_name) foreach ($claims as &$claim) { $claim->user = $userApi->getUser($claim->speaker_uri); $claim->talk = $talkApi->getTalk($claim->talk_uri); - $action = $this->application->request->post('action'); + $action = $this->application->request->post('action'); if ($this->application->request->post('display_name') && $this->application->request->post('display_name') == $claim->display_name @@ -967,7 +993,7 @@ public function talkClaims($friendly_name) $this->render( 'Event/pending-claims.html.twig', [ - 'event' => $event, + 'event' => $event, 'claims' => $claims, ] ); @@ -998,7 +1024,7 @@ private function rejectClaimPendingTalk(TalkApi $talkApi, $claim, $data) public function addTalk($friendly_name) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if (!$event) { return Slim::getInstance()->notFound(); } @@ -1008,13 +1034,13 @@ public function addTalk($friendly_name) } $languageApi = $this->getLanguageApi(); - $languages = $languageApi->getLanguagesChoiceList(); + $languages = $languageApi->getLanguagesChoiceList(); $talkTypeApi = $this->getTalkTypeApi(); - $talkTypes = $talkTypeApi->getTalkTypesChoiceList(); + $talkTypes = $talkTypeApi->getTalkTypesChoiceList(); $trackApi = $this->getTrackApi(); - $tracks = $trackApi->getTracksChoiceList($event->getTracksUri()); + $tracks = $trackApi->getTracksChoiceList($event->getTracksUri()); // default values $sessionKeys = ['duration', 'language', 'type', 'track']; @@ -1025,7 +1051,7 @@ public function addTalk($friendly_name) /** @var FormFactoryInterface $factory */ $factory = $this->application->formFactory; - $form = $factory->create(new TalkFormType($event, $languages, $talkTypes, $tracks), $data); + $form = $factory->create(new TalkFormType($event, $languages, $talkTypes, $tracks), $data); $request = $this->application->request(); if ($request->isPost()) { @@ -1041,7 +1067,7 @@ public function addTalk($friendly_name) try { $talkApi = $this->getTalkApi(); - $talk = $talkApi->addTalk($event->getTalksUri(), $values); + $talk = $talkApi->addTalk($event->getTalksUri(), $values); if (!empty($values['track']) && isset($tracks[$values['track']])) { $talkApi->addTalkToTrack($talk->getTracksUri(), $values['track']); @@ -1063,7 +1089,7 @@ public function addTalk($friendly_name) 'Event/add-talk.html.twig', [ 'event' => $event, - 'form' => $form->createView(), + 'form' => $form->createView(), ] ); } @@ -1076,7 +1102,7 @@ public function addTalk($friendly_name) public function editTracks($friendly_name) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if (!$event) { return Slim::getInstance()->notFound(); } @@ -1085,8 +1111,8 @@ public function editTracks($friendly_name) $this->redirectToDetailPage($event->getUrlFriendlyName()); } - $trackApi = $this->getTrackApi(); - $tracks = $trackApi->getTracks($event->getTracksUri()); + $trackApi = $this->getTrackApi(); + $tracks = $trackApi->getTracks($event->getTracksUri()); $numberOfTracks = 0; if ($tracks && $tracks['meta']['count']) { $data['tracks'] = $tracks['tracks']; @@ -1097,7 +1123,7 @@ public function editTracks($friendly_name) /** @var FormFactoryInterface $factory */ $factory = $this->application->formFactory; - $form = $factory->create(new TrackCollectionFormType(), $data); + $form = $factory->create(new TrackCollectionFormType(), $data); $request = $this->application->request(); if ($request->isPost()) { @@ -1146,7 +1172,7 @@ public function editTracks($friendly_name) 'Event/edit-tracks.html.twig', [ 'event' => $event, - 'form' => $form->createView(), + 'form' => $form->createView(), ] ); } diff --git a/app/src/Event/EventEntity.php b/app/src/Event/EventEntity.php index 59b665a62..b346b9937 100644 --- a/app/src/Event/EventEntity.php +++ b/app/src/Event/EventEntity.php @@ -250,7 +250,7 @@ public function areCommentsEnabled() public function isPastEvent() { $endDate = DateTime::createFromFormat(DateTime::ISO8601, $this->getEndDate()); - $now = new DateTime(null, $endDate->getTimezone()); + $now = new DateTime(null, $endDate->getTimezone()); $now->setTime(0, 0, 0); return ($endDate < $now); diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index dc69bd3c5..a0571c7a7 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -57,7 +57,7 @@ public function getName() public function buildForm(FormBuilderInterface $builder, array $options) { - list ($continents, $cities) = $this->getListOfTimezoneContinentsAndCities(); + list($continents, $cities) = $this->getListOfTimezoneContinentsAndCities(); $timezone = null; if (isset($options['data'])) { @@ -90,7 +90,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'text', [ 'required' => false, - 'attr' => ['placeholder' => 'comma separated, tag, list'] + 'attr' => ['placeholder' => 'comma separated, tag, list'] ] )->addViewTransformer(new EventTagsTransformer()) ) @@ -146,7 +146,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'location', 'text', [ - 'label' => 'Venue name', + 'label' => 'Venue name', 'constraints' => [new Assert\NotBlank()], ] ) @@ -155,7 +155,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'text', [ 'label' => 'Latitude', - 'attr' => ['readonly' => 'readonly'], + 'attr' => ['readonly' => 'readonly'], ] ) ->add( @@ -163,20 +163,20 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'text', [ 'label' => 'Longitude', - 'attr' => ['readonly' => 'readonly'], + 'attr' => ['readonly' => 'readonly'], ] ) ->add( 'new_icon', 'file', [ - 'data_class' => null, - 'label' => 'Upload new icon', - 'required' => false, - 'attr'=> [ - 'class'=>'file', + 'data_class' => null, + 'label' => 'Upload new icon', + 'required' => false, + 'attr' => [ + 'class' => 'file', ], - 'constraints' => [new ValidEventIcon(['groupname' => 'event', 'keyname' =>'new_icon'])], + 'constraints' => [new ValidEventIcon(['groupname' => 'event', 'keyname' => 'new_icon'])], ] ) ; @@ -269,7 +269,7 @@ public function getListOfTimezoneContinentsAndCities() foreach ($timezones as $timezone) { list($continent, $city) = explode('/', $timezone, 2); $continents[$continent] = $continent; - $cities[$city] = $city; + $cities[$city] = $city; } return [$continents, $cities]; @@ -291,7 +291,7 @@ public static function getNestedListOfTimezones() $result = []; foreach ($timezones as $timezone) { list($continent, $city) = explode('/', $timezone, 2); - $result[$continent][] = $city; + $result[$continent][] = $city; } foreach ($result as $continent => $cities) { diff --git a/app/src/Event/EventScheduler.php b/app/src/Event/EventScheduler.php index f6501cdcd..3ccd3d5d9 100644 --- a/app/src/Event/EventScheduler.php +++ b/app/src/Event/EventScheduler.php @@ -35,7 +35,7 @@ public function __construct(TalkApi $talkApi) */ public function getScheduleData(EventEntity $event) { - $talks = $this->getTalks($event->getTalksUri().'?start=0&resultsperpage=1000'); + $talks = $this->getTalks($event->getTalksUri() . '?start=0&resultsperpage=1000'); $eventDays = $this->getEventDays($talks); return $eventDays; @@ -66,7 +66,7 @@ public function getEventDays($talks) return []; } - $talks = $talks['talks']; + $talks = $talks['talks']; $talksByDay = $this->organiseTalksByDayAndTime($talks); $tracksByDay = $this->getTracksByDay($talks); diff --git a/app/src/Event/TrackApi.php b/app/src/Event/TrackApi.php index 48948b525..ebf16b2ed 100644 --- a/app/src/Event/TrackApi.php +++ b/app/src/Event/TrackApi.php @@ -48,7 +48,7 @@ public function getTracksChoiceList($url) public function updateTrack($trackUri, $data) { $params = [ - 'track_name' => $data['track_name'], + 'track_name' => $data['track_name'], 'track_description' => $data['track_description'], ]; @@ -57,7 +57,7 @@ public function updateTrack($trackUri, $data) return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new \Exception("Failed: " . $message); @@ -72,7 +72,7 @@ public function updateTrack($trackUri, $data) public function addTrack($eventTracksUri, $data) { $params = [ - 'track_name' => $data['track_name'], + 'track_name' => $data['track_name'], 'track_description' => $data['track_description'], ]; @@ -81,7 +81,7 @@ public function addTrack($eventTracksUri, $data) return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new \Exception("Failed: " . $message); @@ -99,7 +99,7 @@ public function deleteTrack($trackUri) return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new \Exception("Failed to delete track: " . $message); diff --git a/app/src/Event/TrackFormType.php b/app/src/Event/TrackFormType.php index e3cae0880..c7ff69c0f 100644 --- a/app/src/Event/TrackFormType.php +++ b/app/src/Event/TrackFormType.php @@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'textarea', [ 'constraints' => [new Assert\NotBlank()], - 'attr'=> ['rows' => '2'] + 'attr' => ['rows' => '2'] ] ) ; diff --git a/app/src/Language/LanguageApi.php b/app/src/Language/LanguageApi.php index 2ef445090..86ad079d3 100644 --- a/app/src/Language/LanguageApi.php +++ b/app/src/Language/LanguageApi.php @@ -13,6 +13,7 @@ class LanguageApi extends BaseApi public function getLanguages() { $url = $this->baseApiUrl . '/v2.1/languages'; + $queryParams['resultsperpage'] = 0; $result = $this->apiGet($url, $queryParams); diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 4a7b71060..77e2d2991 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -106,7 +106,6 @@ function () use ($formMiddleWare, $csrfSecret) { */ public function createFormFactory() { - $builder = Forms::createFormFactoryBuilder() ->addExtension( new CsrfExtension( @@ -157,7 +156,7 @@ private function getChainingLoader($env) private function addFormTemplatesFolderToLoader(\Twig_Loader_Chain $loader) { $reflected = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); - $path = dirname($reflected->getFileName()) . '/../Resources/views/Form'; + $path = dirname($reflected->getFileName()) . '/../Resources/views/Form'; $loader->addLoader(new \Twig_Loader_Filesystem($path)); } diff --git a/app/src/Search/SearchController.php b/app/src/Search/SearchController.php index ba84fb38a..8f836b7d7 100644 --- a/app/src/Search/SearchController.php +++ b/app/src/Search/SearchController.php @@ -2,14 +2,10 @@ namespace JoindIn\Web\Search; use JoindIn\Web\Application\BaseController; -use JoindIn\Web\Application\CacheService; use JoindIn\Web\Event\EventApi; -use JoindIn\Web\Event\EventDb; -use Slim\Slim; use JoindIn\Web\Talk\TalkApi; -use JoindIn\Web\Talk\TalkDb; -use JoindIn\Web\User\UserDb; use JoindIn\Web\User\UserApi; +use Slim\Slim; /** * Class SearchController @@ -39,8 +35,10 @@ public function __construct(Slim $app) */ protected function defineRoutes(Slim $app) { - $app->get('/search/events', [$this, 'searchEvents'])->name("search-events"); - $app->get('/search', [$this, 'search'])->name("search"); + $app->get('/search/events', [$this, 'searchEvents']) + ->name("search-events"); + $app->get('/search', [$this, 'search']) + ->name("search"); } /** @@ -75,8 +73,8 @@ public function searchEvents() { $keyword = $this->sanitizeKeyword($this->application->request()->get('keyword')); - $tag = $this->sanitizeTag($this->application->request()->get('tag')); - $events = []; + $tag = $this->sanitizeTag($this->application->request()->get('tag')); + $events = []; $page = ((int)$this->application->request()->get('page') === 0) ? 1 @@ -102,11 +100,11 @@ public function searchEvents() */ public function search() { - $keyword = $this->sanitizeKeyword($this->application->request()->get('keyword')); - $events = []; - $talks = []; - $users = []; - $eventInfo = []; + $keyword = $this->sanitizeKeyword($this->application->request()->get('keyword')); + $events = []; + $talks = []; + $users = []; + $eventInfo = []; $pagination = []; $page = ((int)$this->application->request()->get('page') === 0) @@ -115,8 +113,8 @@ public function search() if (!empty($keyword)) { $events = $this->searchEventsByTitleAndTag($page, $keyword); - $talks = $this->searchTalksByTitle($page, $keyword); - $users = $this->searchUsersByKeyword($page, $keyword); + $talks = $this->searchTalksByTitle($page, $keyword); + $users = $this->searchUsersByKeyword($page, $keyword); // combine pagination data for events and talks $pagination = $this->combinePaginationData( @@ -181,9 +179,9 @@ private function searchEventsByTitleAndTag($page, $keyword, $tag = null) private function searchTalksByTitle($page, $keyword) { $apiQueryParams = [ - 'title' => $keyword, + 'title' => $keyword, 'resultsperpage' => $this->itemsPerPage, - 'start' => ($page - 1) * $this->itemsPerPage + 'start' => ($page - 1) * $this->itemsPerPage ]; return $this->getTalkApi()->getCollection( @@ -201,10 +199,10 @@ private function searchTalksByTitle($page, $keyword) private function searchUsersByKeyword($page, $keyword) { $apiQueryParams = [ - 'keyword' => $keyword, + 'keyword' => $keyword, 'resultsperpage' => $this->itemsPerPage, - 'start' => ($page - 1) * $this->itemsPerPage, - 'verbose' => 'yes' + 'start' => ($page - 1) * $this->itemsPerPage, + 'verbose' => 'yes' ]; return $this->getUserApi()->getCollection($apiQueryParams); @@ -245,7 +243,7 @@ private function getEventInfoForTalks(array $talks) $events = []; foreach ($talks as $talk) { - $eventUri = $talk->getEventUri(); + $eventUri = $talk->getEventUri(); $events[$eventUri] = $eventApi->getEvent($eventUri); } diff --git a/app/src/Talk/SpeakerFormType.php b/app/src/Talk/SpeakerFormType.php index 29aa8cb36..0601d7e4f 100644 --- a/app/src/Talk/SpeakerFormType.php +++ b/app/src/Talk/SpeakerFormType.php @@ -4,8 +4,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Validator\Constraints as Assert; -use JoindIn\Web\Event\EventEntity; /** * Form used to render and validate the speakers collection on a Talk form @@ -34,9 +32,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('name', 'text', [ - 'label' => false, + 'label' => false, 'required' => false, - ]) - ; + ]); } } diff --git a/app/src/Talk/TalkApi.php b/app/src/Talk/TalkApi.php index 440455ffb..ab40e89d2 100644 --- a/app/src/Talk/TalkApi.php +++ b/app/src/Talk/TalkApi.php @@ -24,7 +24,7 @@ class TalkApi extends BaseApi public function __construct($config, $accessToken, TalkDb $talkDb, UserApi $userApi) { parent::__construct($config, $accessToken); - $this->talkDb = $talkDb; + $this->talkDb = $talkDb; $this->userApi = $userApi; } @@ -171,12 +171,12 @@ public function getComments($comment_uri, $verbose = false, $limitTo = null) */ public function addComment($talk, $rating, $comment) { - $uri = $talk->getCommentsUri(); + $uri = $talk->getCommentsUri(); $params = [ - 'rating' => $rating, + 'rating' => $rating, 'comment' => $comment, ]; - list ($status, $result) = $this->apiPost($uri, $params); + list($status, $result) = $this->apiPost($uri, $params); if ($status == 201) { return true; @@ -186,7 +186,7 @@ public function addComment($talk, $rating, $comment) public function reportComment($uri) { - list ($status, $result) = $this->apiPost($uri); + list($status, $result) = $this->apiPost($uri); if ($status == 202) { return true; @@ -202,12 +202,12 @@ public function reportComment($uri) public function toggleStar($talk) { if ($talk->getStarred()) { - list ($status, $result) = $this->apiDelete($talk->getStarredUri(), []); + list($status, $result) = $this->apiDelete($talk->getStarredUri(), []); if ($status == 200) { return ['starred' => false]; } } else { - list ($status, $result) = $this->apiPost($talk->getStarredUri(), []); + list($status, $result) = $this->apiPost($talk->getStarredUri(), []); if ($status == 201) { return ['starred' => true]; } @@ -233,9 +233,9 @@ public function getAgenda($talksUri) $agenda = []; foreach ($talks as $talk) { - $date = $talk->getStartDateTime()->format("Y-m-d"); - $startTime = $talk->getStartDateTime()->format("H:i"); - $time = "$startTime"; + $date = $talk->getStartDateTime()->format("Y-m-d"); + $startTime = $talk->getStartDateTime()->format("H:i"); + $time = "$startTime"; $agenda[$date][$time][] = $talk; } @@ -268,7 +268,7 @@ public function addTalk($talksUri, $data) } - list ($status, $result, $headers) = $this->apiPost($talksUri, $data); + list($status, $result, $headers) = $this->apiPost($talksUri, $data); // if successful, return talk entity represented by the URL in the Location header if ($status == 201) { $response = $this->getCollection($headers['location']); @@ -312,10 +312,10 @@ public function editTalk($talkUri, $data) $data['speakers'] = array_filter($data['speakers']); } $talkId = basename($talkUri); - $media = $this->getTalkLinksById($talkId); + $media = $this->getTalkLinksById($talkId); $this->handleTalkLinksUpdate($talkId, $media, $data['talk_media']); - list ($status, $result, $headers) = $this->apiPut($talkUri, $data); + list($status, $result, $headers) = $this->apiPut($talkUri, $data); // if successful, return talk entity represented by the URL in the Location header if ($status == 204) { @@ -333,13 +333,13 @@ public function editTalk($talkUri, $data) public function claimTalk($talkSpeakersUri, $data) { - list ($status, $result, $headers) = $this->apiPost($talkSpeakersUri, $data); + list($status, $result, $headers) = $this->apiPost($talkSpeakersUri, $data); if ($status == 204) { return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new Exception("Failed: " . $message); @@ -347,13 +347,13 @@ public function claimTalk($talkSpeakersUri, $data) public function rejectTalkClaim($talkSpeakersUri, $data) { - list ($status, $result, $headers) = $this->apiDelete($talkSpeakersUri, $data); + list($status, $result, $headers) = $this->apiDelete($talkSpeakersUri, $data); if ($status == 204) { return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new Exception("Failed: " . $message); @@ -378,7 +378,7 @@ public function addTalkToTrack($talkTracksUri, $trackUri) return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new Exception("Failed: " . $message); @@ -398,7 +398,7 @@ public function removeTalkFromTrack($removeTrackUri) return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new Exception("Failed to remove talk from track: " . $message); @@ -412,7 +412,7 @@ public function unlinkVerifiedSpeakerFromTalk($unlinkSpeakerUri) return true; } - $result = json_decode($result); + $result = json_decode($result); $message = $result[0]; throw new \Exception("Failed to unlink speaker from talk: " . $message); @@ -430,7 +430,7 @@ public function unlinkVerifiedSpeakerFromTalk($unlinkSpeakerUri) */ public function deleteTalk($clientUri) { - list ($status, $result, $headers) = $this->apiDelete($clientUri); + list($status, $result, $headers) = $this->apiDelete($clientUri); if ($status != 204) { $decoded = json_decode($result); @@ -495,7 +495,7 @@ protected function addTalkMedia($talkId, $media) $talkUrl = $this->baseApiUrl . '/v2.1/talks/' . $talkId . '/links'; $params = [ 'display_name' => $media['type'], - 'url' => $media['url'], + 'url' => $media['url'], ]; list($status, $result, $headers) = $this->apiPost($talkUrl, $params); @@ -511,7 +511,7 @@ protected function updateTalkMedia($talkId, $mediaId, $media) $talkUrl = $this->baseApiUrl . '/v2.1/talks/' . $talkId . '/links/' . $mediaId; $params = [ 'display_name' => $media['type'], - 'url' => $media['url'], + 'url' => $media['url'], ]; list($status, $result, $headers) = $this->apiPut($talkUrl, $params); if ($status == 204) { diff --git a/app/src/Talk/TalkCommentEntity.php b/app/src/Talk/TalkCommentEntity.php index 5794fa6dc..fcda42073 100644 --- a/app/src/Talk/TalkCommentEntity.php +++ b/app/src/Talk/TalkCommentEntity.php @@ -44,7 +44,6 @@ public function getCommentUri() public function canRateTalk($user_uri) { - if (isset($this->data->user_uri) && $this->data->user_uri == $user_uri) { return false; } diff --git a/app/src/Talk/TalkController.php b/app/src/Talk/TalkController.php index d0324a0f0..1f84ec4af 100644 --- a/app/src/Talk/TalkController.php +++ b/app/src/Talk/TalkController.php @@ -1,18 +1,16 @@ getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $event = $eventApi->getByFriendlyUrl($eventSlug); if (!$event) { return Slim::getInstance()->notFound(); } $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); + $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); if (!$talk) { return Slim::getInstance()->notFound(); } @@ -110,7 +108,7 @@ public function editTalk($eventSlug, $talkSlug) } $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $event = $eventApi->getByFriendlyUrl($eventSlug); if (!$event) { $this->application->notFound(); @@ -118,15 +116,15 @@ public function editTalk($eventSlug, $talkSlug) } $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); + $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); if (!$talk) { $this->application->notFound(); return; } - $talkId = basename($talk['uri']); + $talkId = basename($talk['uri']); $talkMedia = $talkApi->getTalkLinksById($talkId); - $isAdmin = $event->getCanEdit(); + $isAdmin = $event->getCanEdit(); $isSpeaker = $talk->isSpeaker($_SESSION['user']->getUri()); if (!($isAdmin || $isSpeaker)) { $this->application->flash('error', "You do not have permission to do this."); @@ -136,22 +134,22 @@ public function editTalk($eventSlug, $talkSlug) } $languageApi = $this->getLanguageApi(); - $languages = $languageApi->getLanguagesChoiceList(); + $languages = $languageApi->getLanguagesChoiceList(); $talkTypeApi = $this->getTalkTypeApi(); - $talkTypes = $talkTypeApi->getTalkTypesChoiceList(); + $talkTypes = $talkTypeApi->getTalkTypesChoiceList(); $trackApi = $this->getTrackApi(); - $tracks = $trackApi->getTracksChoiceList($event->getTracksUri()); + $tracks = $trackApi->getTracksChoiceList($event->getTracksUri()); // default values - $data = []; - $data['talk_title'] = $talk->getTitle(); + $data = []; + $data['talk_title'] = $talk->getTitle(); $data['talk_description'] = $talk->getDescription(); - $data['start_date'] = $talk->getStartDateTime(); - $data['duration'] = $talk->getDuration(); - $data['language'] = $talk->getLanguage(); - $data['type'] = $talk->getType(); + $data['start_date'] = $talk->getStartDateTime(); + $data['duration'] = $talk->getDuration(); + $data['language'] = $talk->getLanguage(); + $data['type'] = $talk->getType(); if ($talk->getTracks()) { $data['track'] = $talk->getTracks()[0]->track_uri; } @@ -164,13 +162,13 @@ public function editTalk($eventSlug, $talkSlug) foreach ($talkMedia as $media) { $data['talk_media'][$media->id] = [ 'type' => $media->display_name, - 'url' => $media->url + 'url' => $media->url ]; } /** @var FormFactoryInterface $factory */ $factory = $this->application->formFactory; - $form = $factory->create(new TalkFormType($event, $languages, $talkTypes, $tracks), $data); + $form = $factory->create(new TalkFormType($event, $languages, $talkTypes, $tracks), $data); $request = $this->application->request(); if ($request->isPost()) { @@ -186,7 +184,7 @@ public function editTalk($eventSlug, $talkSlug) try { $talkApi = $this->getTalkApi(); - $talk = $talkApi->editTalk($talk->getApiUri(), $values); + $talk = $talkApi->editTalk($talk->getApiUri(), $values); if (!empty($values['track']) && isset($tracks[$values['track']])) { $talkTracks = []; @@ -222,10 +220,10 @@ public function editTalk($eventSlug, $talkSlug) $this->render( 'Talk/edit-talk.html.twig', [ - 'talk' => $talk, - 'event' => $event, + 'talk' => $talk, + 'event' => $event, 'talkSlug' => $talkSlug, - 'form' => $form->createView(), + 'form' => $form->createView(), ] ); } @@ -240,10 +238,10 @@ public function claimTalk($eventSlug, $talkSlug) ); } - $request = $this->application->request(); + $request = $this->application->request(); $display_name = $request->post('display_name'); - $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $eventApi = $this->getEventApi(); + $event = $eventApi->getByFriendlyUrl($eventSlug); if (!$event) { $this->application->notFound(); @@ -251,14 +249,14 @@ public function claimTalk($eventSlug, $talkSlug) } $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); + $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); if (!$talk) { $this->application->notFound(); return; } $speakers = $talk->getSpeakers(); - $valid = false; + $valid = false; foreach ($speakers as $speaker) { if (! isset($speaker->speaker_uri) && $speaker->speaker_name == $display_name) { $valid = true; @@ -294,7 +292,7 @@ public function claimTalk($eventSlug, $talkSlug) public function star($eventSlug, $talkSlug) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $event = $eventApi->getByFriendlyUrl($eventSlug); $this->application->contentType('application/json'); if (!$event) { @@ -303,7 +301,7 @@ public function star($eventSlug, $talkSlug) } $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); + $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); if (!$talk) { $this->application->notFound(); return; @@ -323,10 +321,10 @@ public function star($eventSlug, $talkSlug) public function quick($talkStub) { $talkDb = $this->application->container->get(TalkDb::class); - $talk = $talkDb->load('stub', $talkStub); + $talk = $talkDb->load('stub', $talkStub); $eventDb = $this->application->container->get(EventDb::class); - $event = $eventDb->load('uri', $talk['event_uri']); + $event = $eventDb->load('uri', $talk['event_uri']); if (!$event) { return \Slim\Slim::getInstance()->notFound(); } @@ -344,7 +342,7 @@ public function quickById($talkId) $eventDb = $this->application->container->get(EventDb::class); $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkByTalkId($talkId); + $talk = $talkApi->getTalkByTalkId($talkId); if (!$talk) { return \Slim\Slim::getInstance()->notFound(); } @@ -352,7 +350,7 @@ public function quickById($talkId) $event = $eventDb->load('uri', $talk->getEventUri()); if (!$event) { // load from API as not in cache - $eventApi = $this->getEventApi(); + $eventApi = $this->getEventApi(); $eventEntity = $eventApi->getEvent($talk->getEventUri()); if (!$eventEntity) { return \Slim\Slim::getInstance()->notFound(); @@ -372,8 +370,8 @@ public function addComment($eventSlug, $talkSlug) { $request = $this->application->request(); $comment = trim(strip_tags($request->post('comment'))); - $rating = (int) $request->post('rating'); - $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); + $rating = (int)$request->post('rating'); + $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); if ($comment == '' || $rating == 0) { $this->application->flash('error', 'Please provide a comment and rating'); @@ -390,10 +388,10 @@ public function addComment($eventSlug, $talkSlug) } $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $event = $eventApi->getByFriendlyUrl($eventSlug); $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); + $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); if ($talk) { try { $talkApi->addComment($talk, $rating, $comment); @@ -434,10 +432,10 @@ public function addComment($eventSlug, $talkSlug) public function reportComment($eventSlug, $talkSlug, $commentHash) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); - $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); - $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); + $event = $eventApi->getByFriendlyUrl($eventSlug); + $talkApi = $this->getTalkApi(); + $talk = $talkApi->getTalkBySlug($talkSlug, $event->getUri()); + $url = $this->application->urlFor("talk", ['eventSlug' => $eventSlug, 'talkSlug' => $talkSlug]); $comments = $talkApi->getComments($talk->getCommentsUri()); foreach ($comments as $comment) { @@ -475,16 +473,16 @@ public function unlinkSpeaker($eventSlug, $talkSlug, $username) } $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $event = $eventApi->getByFriendlyUrl($eventSlug); $eventUri = $event->getUri(); $talkApi = $this->getTalkApi(); - $talk = $talkApi->getTalkBySlug($talkSlug, $eventUri); + $talk = $talkApi->getTalkBySlug($talkSlug, $eventUri); $talkUri = $talk->getApiUri(); $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); - $userId = $user->getId(); + $user = $userApi->getUserByUsername($username); + $userId = $user->getId(); $unlinkSpeakerUri = $talkUri . "/speakers/" . $userId; @@ -542,7 +540,7 @@ public function deleteTalk($eventSlug, $talkSlug) } // default values - $data = []; + $data = []; $data['talk_uri'] = $talk->getApiUri(); $factory = $this->application->formFactory; @@ -581,7 +579,7 @@ public function deleteTalk($eventSlug, $talkSlug) $this->render( 'Talk/delete-talk.html.twig', [ - 'talk' => $talk, + 'talk' => $talk, 'form' => $form->createView(), 'backUri' => $this->application->urlFor('talk', [ 'eventSlug' => $eventSlug, diff --git a/app/src/Talk/TalkEntity.php b/app/src/Talk/TalkEntity.php index b8df2859f..ca1a5a853 100644 --- a/app/src/Talk/TalkEntity.php +++ b/app/src/Talk/TalkEntity.php @@ -61,7 +61,7 @@ public function getEndDateTime() } $start_time = $this->getStartDateTime(); - $end_time = $start_time->add(new DateInterval('PT'.$this->data->duration.'M')); + $end_time = $start_time->add(new DateInterval('PT' . $this->data->duration . 'M')); return $end_time; } diff --git a/app/src/Talk/TalkFormType.php b/app/src/Talk/TalkFormType.php index f4e5af171..f3d705464 100644 --- a/app/src/Talk/TalkFormType.php +++ b/app/src/Talk/TalkFormType.php @@ -45,17 +45,16 @@ class TalkFormType extends AbstractType public function __construct(EventEntity $event, array $languages, array $talkTypes, array $tracks) { - $this->timezone = $event->getFullTimezone(); - $tz = new \DateTimeZone($this->timezone); + $this->timezone = $event->getFullTimezone(); + $tz = new \DateTimeZone($this->timezone); $this->startDate = new \DateTimeImmutable($event->getStartDate(), $tz); - $this->endDate = new \DateTimeImmutable($event->getEndDate(), $tz); + $this->endDate = new \DateTimeImmutable($event->getEndDate(), $tz); $this->languages = $languages; $this->talkTypes = $talkTypes; - $this->tracks = $tracks; + $this->tracks = $tracks; } - /** * Returns the name of this form type. * @@ -89,40 +88,40 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'textarea', [ 'constraints' => [new Assert\NotBlank()], - 'attr'=> ['rows' => '10'] + 'attr' => ['rows' => '10'] ] ) ->add( 'start_date', 'datetime', [ - 'label' => 'Date and time of talk', - 'date_widget' => 'single_text', - 'time_widget' => 'single_text', - 'date_format' => 'd MMMM y', + 'label' => 'Date and time of talk', + 'date_widget' => 'single_text', + 'time_widget' => 'single_text', + 'date_format' => 'd MMMM y', 'model_timezone' => $this->timezone, - 'view_timezone' => $this->timezone, - 'constraints' => [ + 'view_timezone' => $this->timezone, + 'constraints' => [ new Assert\NotBlank(), new Assert\Date() ], 'attr' => [ 'date_widget' => [ - 'class' => 'date-picker form-control', - 'data-provide' => 'datepicker', - 'data-date-format' => 'd MM yyyy', - 'data-date-week-start' => '1', - 'data-date-autoclose' => '1', + 'class' => 'date-picker form-control', + 'data-provide' => 'datepicker', + 'data-date-format' => 'd MM yyyy', + 'data-date-week-start' => '1', + 'data-date-autoclose' => '1', 'data-date-today-highlight' => true, - 'data-date-start-date '=> $this->startDate->format('j F Y'), - 'data-date-end-date' => $this->endDate->format('j F Y'), + 'data-date-start-date ' => $this->startDate->format('j F Y'), + 'data-date-end-date' => $this->endDate->format('j F Y'), ], 'time_widget' => [ - 'class' => 'time-picker form-control', - 'data-provide' => 'timepicker', + 'class' => 'time-picker form-control', + 'data-provide' => 'timepicker', 'data-show-meridian' => 'false', - 'data-default-time' => '09:00', - 'placeholder' => 'HH:MM', + 'data-default-time' => '09:00', + 'placeholder' => 'HH:MM', ], ] ] @@ -131,8 +130,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'duration', 'integer', [ - 'label' => 'Duration (mins)', - 'precision' => 0, + 'label' => 'Duration (mins)', + 'precision' => 0, 'constraints' => [ new Assert\NotBlank(), new Assert\Type('integer'), @@ -161,17 +160,17 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'track', 'choice', [ - 'required' => (bool) !empty($this->tracks), - 'choices' => ['' => ''] + $this->tracks + 'required' => (bool) ! empty($this->tracks), + 'choices' => ['' => ''] + $this->tracks ] ) ->add( 'speakers', 'collection', [ - 'label' => 'Speakers!', - 'type' => new SpeakerFormType(), - 'allow_add' => true, + 'label' => 'Speakers!', + 'type' => new SpeakerFormType(), + 'allow_add' => true, 'allow_delete' => true, ] ) @@ -179,9 +178,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'talk_media', 'collection', [ - 'label' => 'Talk Media', - 'type' => new TalkMediaFormType(), - 'allow_add' => true, + 'label' => 'Talk Media', + 'type' => new TalkMediaFormType(), + 'allow_add' => true, 'allow_delete' => true, ] ) diff --git a/app/src/Talk/TalkMediaFormType.php b/app/src/Talk/TalkMediaFormType.php index 238f286cd..68cb6ee32 100644 --- a/app/src/Talk/TalkMediaFormType.php +++ b/app/src/Talk/TalkMediaFormType.php @@ -32,7 +32,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('url', 'text', [ - 'label' => false, + 'label' => false, 'required' => false, ]) ->add( diff --git a/app/src/Talk/TalkTypeApi.php b/app/src/Talk/TalkTypeApi.php index 14b58b225..b8647fc3c 100644 --- a/app/src/Talk/TalkTypeApi.php +++ b/app/src/Talk/TalkTypeApi.php @@ -12,7 +12,7 @@ class TalkTypeApi extends BaseApi */ public function getTalkTypes() { - $url = $this->baseApiUrl . '/v2.1/talk_types'; + $url = $this->baseApiUrl . '/v2.1/talk_types'; $queryParams['resultsperpage'] = 0; $result = $this->apiGet($url, $queryParams); diff --git a/app/src/User/AuthApi.php b/app/src/User/AuthApi.php index 962522536..ec33dd8a2 100644 --- a/app/src/User/AuthApi.php +++ b/app/src/User/AuthApi.php @@ -50,7 +50,7 @@ public function getTwitterRequestToken($clientId, $clientSecret) 'client_secret' => $clientSecret, ]; - list ($status, $result, $headers) = $this->apiPost($url, $params); + list($status, $result, $headers) = $this->apiPost($url, $params); if ($status == 201) { // we got one, data is actually in the body $data = json_decode($result); @@ -78,7 +78,7 @@ public function verifyTwitter($clientId, $clientSecret, $token, $verifier) 'verifier' => $verifier, ]; - list ($status, $result, $headers) = $this->apiPost($url, $params); + list($status, $result, $headers) = $this->apiPost($url, $params); if ($result) { $data = json_decode($result); if ($data) { @@ -99,14 +99,14 @@ public function verifyTwitter($clientId, $clientSecret, $token, $verifier) */ public function verifyFacebook($clientId, $clientSecret, $code) { - $url = $this->baseApiUrl . '/v2.1/facebook/token'; + $url = $this->baseApiUrl . '/v2.1/facebook/token'; $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, 'code' => $code, ]; - list ($status, $result, $headers) = $this->apiPost($url, $params); + list($status, $result, $headers) = $this->apiPost($url, $params); if ($result) { $data = json_decode($result); if ($data) { diff --git a/app/src/User/EmailInputFormType.php b/app/src/User/EmailInputFormType.php index 496fb29ce..335598e67 100644 --- a/app/src/User/EmailInputFormType.php +++ b/app/src/User/EmailInputFormType.php @@ -39,7 +39,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'email', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], ] ) diff --git a/app/src/User/RegisterFormType.php b/app/src/User/RegisterFormType.php index 7f9dbccdc..3753ff657 100644 --- a/app/src/User/RegisterFormType.php +++ b/app/src/User/RegisterFormType.php @@ -46,19 +46,19 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'password', 'repeated', [ - 'type' => 'password', + 'type' => 'password', 'invalid_message' => 'The password fields must match.', - 'required' => true, - 'first_options' => ['label' => 'Password'], - 'second_options' => ['label' => 'Repeat Password'], - 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 6])], + 'required' => true, + 'first_options' => ['label' => 'Password'], + 'second_options' => ['label' => 'Repeat Password'], + 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 6])], ] ) ->add( 'email', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], ] ) @@ -66,7 +66,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'full_name', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 200])], ] ) @@ -81,10 +81,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'biography', 'textarea', [ - 'required' => false, + 'required' => false, 'empty_data' => '', - 'attr' => [ - 'rows' => 4, + 'attr' => [ + 'rows' => 4, 'maxlength' => '400' ] ] diff --git a/app/src/User/UserApi.php b/app/src/User/UserApi.php index 03d6ef314..8256ae7c5 100644 --- a/app/src/User/UserApi.php +++ b/app/src/User/UserApi.php @@ -2,7 +2,6 @@ namespace JoindIn\Web\User; use JoindIn\Web\Application\BaseApi; -use Symfony\Component\Form\Form; class UserApi extends BaseApi { @@ -71,7 +70,7 @@ public function getUserByUserId($userId) public function register($data) { - list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users', $data); + list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users', $data); if ($status == 201) { // user URI in $headers['location'] but the user is pending so it's not useful @@ -101,7 +100,7 @@ public function verify($token) { $data = ["token" => $token]; - list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users/verifications', $data); + list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users/verifications', $data); if ($status == 204) { return true; @@ -123,7 +122,7 @@ public function reverify($email) { $data = ["email" => $email]; - list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/emails/verifications', $data); + list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/emails/verifications', $data); if ($status == 202) { return true; @@ -147,8 +146,8 @@ public function reverify($email) public function getUserByUsername($username) { // fetch via filtering the users collection - $url = $this->baseApiUrl . '/v2.1/users'; - $result = $this->apiGet($url, ['username' => $username, 'verbose'=>'yes']); + $url = $this->baseApiUrl . '/v2.1/users'; + $result = $this->apiGet($url, ['username' => $username, 'verbose' => 'yes']); if ($result) { $data = json_decode($result); @@ -203,7 +202,7 @@ public function usernameReminder($email) { $data = ["email" => $email]; - list ($status, $result, $headers) = $this->apiPost( + list($status, $result, $headers) = $this->apiPost( $this->baseApiUrl . '/v2.1/emails/reminders/username', $data ); @@ -234,7 +233,7 @@ public function passwordReset($username) { $data = ["username" => $username]; - list ($status, $result, $headers) = $this->apiPost( + list($status, $result, $headers) = $this->apiPost( $this->baseApiUrl . '/v2.1/emails/reminders/password', $data ); @@ -265,7 +264,7 @@ public function passwordReset($username) */ public function edit($uri, array $data) { - list ($status, $result, $headers) = $this->apiPut($uri, $data); + list($status, $result, $headers) = $this->apiPut($uri, $data); // if successful, return event entity represented by the URL in the Location header if ($status == 204) { @@ -276,10 +275,9 @@ public function edit($uri, array $data) throw new \Exception('Your profile update was not accepted. The server reports: ' . $result); } - public function delete($uri) { - list ($status, $result) = $this->apiDelete($uri, []); + list($status, $result) = $this->apiDelete($uri, []); if ($status == 204) { return true; @@ -304,7 +302,7 @@ public function resetPassword($token, $password) "password" => $password, ]; - list ($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users/passwords', $data); + list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users/passwords', $data); if ($status == 204) { return true; diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index 25b340594..16f63f7db 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -78,7 +78,7 @@ protected function defineRoutes(Slim $app) */ public function login() { - $config = $this->application->config('oauth'); + $config = $this->application->config('oauth'); $request = $this->application->request(); $error = false; @@ -86,14 +86,14 @@ public function login() // handle submission of login form // make a call to the api with granttype=password - $username = $request->post('username'); - $password = $request->post('password'); - $redirect = $request->post('redirect'); - $clientId = $config['client_id']; + $username = $request->post('username'); + $password = $request->post('password'); + $redirect = $request->post('redirect'); + $clientId = $config['client_id']; $clientSecret = $config['client_secret']; $authApi = $this->application->container->get(AuthApi::class); - $result = $authApi->login($username, $password, $clientId, $clientSecret); + $result = $authApi->login($username, $password, $clientId, $clientSecret); $this->handleLogin($result, $redirect); } @@ -149,7 +149,7 @@ public function register() */ protected function registerUserUsingForm($form) { - $values = $form->getData(); + $values = $form->getData(); $userApi = $this->getUserApi(); $result = false; @@ -171,7 +171,7 @@ protected function registerUserUsingForm($form) */ public function logout() { - $request = $this->application->request(); + $request = $this->application->request(); $redirect = ($request->get('redirect')) ? $request->get('redirect') : "/"; if (isset($_SESSION['user'])) { @@ -193,7 +193,7 @@ public function verification() { $request = $this->application->request(); - $token = $request->get('token'); + $token = $request->get('token'); $userApi = $this->getUserApi(); try { @@ -219,7 +219,7 @@ public function resendVerification() if ($form->isValid()) { $values = $form->getData(); - $email = $values['email']; + $email = $values['email']; $userApi = $this->getUserApi(); @@ -263,15 +263,15 @@ public function profile($username) Slim::getInstance()->notFound(); } - $talkDb = $this->getTalkDb(); - $talkApi = $this->getTalkApi(); + $talkDb = $this->getTalkDb(); + $talkApi = $this->getTalkApi(); $eventApi = $this->getEventApi(); $eventInfo = []; // look up an event's name and url_friendly_name from its uri - $talkInfo = []; // look up a talk's url_friendly_talk_title from its uri + $talkInfo = []; // look up a talk's url_friendly_talk_title from its uri $talkCollection = $talkApi->getCollection($user->getTalksUri(), ['verbose' => 'yes', 'resultsperpage' => 5]); - $talks = false; + $talks = false; if (isset($talkCollection['talks'])) { $talks = $talkCollection['talks']; foreach ($talks as $talk) { @@ -308,11 +308,13 @@ public function profile($username) $talkData = $talkDb->load('uri', $comment->getTalkUri()); if ($talkData) { $eventUri = $talkData['event_uri']; + $talkInfo[$comment->getTalkUri()]['url_friendly_talk_title'] = $talkData['slug']; } else { $talk = $talkApi->getTalk($comment->getTalkUri()); if ($talk) { $eventUri = $talk->getEventUri(); + $talkInfo[$comment->getTalkUri()]['url_friendly_talk_title'] = $talk->getUrlFriendlyTalkTitle(); } } @@ -346,7 +348,7 @@ public function profile($username) public function profileTalks($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); if (!$user) { Slim::getInstance()->notFound(); } @@ -388,12 +390,12 @@ public function profileTalks($username) public function profileEvents($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); if (!$user) { Slim::getInstance()->notFound(); } - $eventApi = $this->getEventApi(); + $eventApi = $this->getEventApi(); $eventsCollection = $eventApi->getCollection( $user->getAttendedEventsUri(), ['verbose' => 'yes', 'resultsperpage' => 0] @@ -421,12 +423,12 @@ public function profileEvents($username) public function profileHosted($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); if (!$user) { Slim::getInstance()->notFound(); } - $eventApi = $this->getEventApi(); + $eventApi = $this->getEventApi(); $hostedEventsCollection = $eventApi->getCollection( $user->getHostedEventsUri(), ['verbose' => 'yes', 'resultsperpage' => 0] @@ -455,20 +457,20 @@ public function profileHosted($username) public function profileComments($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); if (!$user) { Slim::getInstance()->notFound(); } - $talkDb = $this->getTalkDb(); - $talkApi = $this->getTalkApi(); - $eventApi = $this->getEventApi(); + $talkDb = $this->getTalkDb(); + $talkApi = $this->getTalkApi(); + $eventApi = $this->getEventApi(); $talkComments = $talkApi->getComments($user->getTalkCommentsUri(), true, 0); if (!$talkComments) { $this->application->redirect($this->application->urlFor('user-profile', ['username' => $username])); } - $talkInfo = []; + $talkInfo = []; $eventInfo = []; foreach ($talkComments as $comment) { if (isset($talkInfo[$comment->getTalkUri()])) { @@ -477,11 +479,13 @@ public function profileComments($username) $talkData = $talkDb->load('uri', $comment->getTalkUri()); if ($talkData) { $eventUri = $talkData['event_uri']; + $talkInfo[$comment->getTalkUri()]['url_friendly_talk_title'] = $talkData['slug']; } else { $talk = $talkApi->getTalk($comment->getTalkUri()); if ($talk) { $eventUri = $talk->getEventUri(); + $talkInfo[$comment->getTalkUri()]['url_friendly_talk_title'] = $talk->getUrlFriendlyTalkTitle(); } } @@ -505,7 +509,7 @@ public function profileComments($username) protected function lookupEventInfo($eventUri) { - $eventDb = $this->getEventDb(); + $eventDb = $this->getEventDb(); $eventApi = $this->getEventApi(); $eventInfo = []; @@ -577,7 +581,7 @@ public function remindUsername() if ($form->isValid()) { $values = $form->getData(); - $email = $values['email']; + $email = $values['email']; $userApi = $this->getUserApi(); @@ -615,7 +619,7 @@ public function remindUsername() public function profileEdit($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); if (!$user) { Slim::getInstance()->notFound(); } @@ -628,12 +632,12 @@ public function profileEdit($username) // create an array of the data to be edited for use by the form $userData = [ - 'full_name' => $user->getFullName(), - 'email' => $user->getEmail(), + 'full_name' => $user->getFullName(), + 'email' => $user->getEmail(), 'twitter_username' => $user->getTwitterUsername(), - 'biography' => $user->getBiography(), - 'old_password' => '', - 'password' => '', + 'biography' => $user->getBiography(), + 'old_password' => '', + 'password' => '', ]; // can only change password if we're editing ourselves @@ -689,8 +693,8 @@ public function profileEdit($username) $this->render( 'User/profile-edit.html.twig', [ - 'thisUser' => $user, - 'form' => $form->createView(), + 'thisUser' => $user, + 'form' => $form->createView(), 'can_change_password' => $canChangePassword, ] ); @@ -699,7 +703,7 @@ public function profileEdit($username) public function userDelete($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); try { // LDBG($values);exit; @@ -728,7 +732,7 @@ public function resetPassword() $form->submit($request->post($form->getName())); if ($form->isValid()) { - $values = $form->getData(); + $values = $form->getData(); $username = $values['username']; $userApi = $this->getUserApi(); @@ -766,7 +770,7 @@ public function resetPassword() public function newPassword() { $request = $this->application->request(); - $token = $request->get('token'); + $token = $request->get('token'); /** @var FormFactoryInterface $factory */ $factory = $this->application->formFactory; @@ -776,7 +780,7 @@ public function newPassword() $form->submit($request->post($form->getName())); if ($form->isValid()) { - $values = $form->getData(); + $values = $form->getData(); $userApi = $this->getUserApi(); try { @@ -811,11 +815,11 @@ public function newPassword() public function loginWithTwitter() { // ask the API for a request token - $config = $this->application->config('oauth'); - $clientId = $config['client_id']; + $config = $this->application->config('oauth'); + $clientId = $config['client_id']; $clientSecret = $config['client_secret']; - $authApi = $this->application->container->get(AuthApi::class); + $authApi = $this->application->container->get(AuthApi::class); $request_token = $authApi->getTwitterRequestToken($clientId, $clientSecret); if ($request_token) { @@ -836,19 +840,19 @@ public function loginWithTwitter() */ public function accessTokenFromTwitter() { - $config = $this->application->config('oauth'); + $config = $this->application->config('oauth'); $request = $this->application->request(); // pass verification to the API so we can log in - $clientId = $config['client_id']; + $clientId = $config['client_id']; $clientSecret = $config['client_secret']; // handle incoming vars - $token = $request->get('oauth_token'); + $token = $request->get('oauth_token'); $verifier = $request->get('oauth_verifier'); $authApi = $this->application->container->get(AuthApi::class); - $result = $authApi->verifyTwitter($clientId, $clientSecret, $token, $verifier); + $result = $authApi->verifyTwitter($clientId, $clientSecret, $token, $verifier); $this->handleLogin($result); } @@ -858,18 +862,18 @@ public function accessTokenFromTwitter() */ public function accessTokenFromFacebook() { - $config = $this->application->config('oauth'); + $config = $this->application->config('oauth'); $request = $this->application->request(); // pass verification to the API so we can log in - $clientId = $config['client_id']; + $clientId = $config['client_id']; $clientSecret = $config['client_secret']; // handle incoming vars $code = $request->get('code'); $authApi = $this->application->container->get(AuthApi::class); - $result = $authApi->verifyFacebook($clientId, $clientSecret, $code); + $result = $authApi->verifyFacebook($clientId, $clientSecret, $code); $this->handleLogin($result); } @@ -900,7 +904,7 @@ protected function handleLogin($result, $redirect = '') session_regenerate_id(true); $_SESSION['access_token'] = $result->access_token; - $this->accessToken = $_SESSION['access_token']; + $this->accessToken = $_SESSION['access_token']; // now get users details $userApi = $this->getUserApi(); @@ -923,7 +927,7 @@ protected function handleLogin($result, $redirect = '') public function redirectFromId($userId) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUserId($userId); + $user = $userApi->getUserByUserId($userId); if (!$user) { return $this->application->notFound(); } diff --git a/app/src/User/UserDb.php b/app/src/User/UserDb.php index 49572fb1b..196482781 100644 --- a/app/src/User/UserDb.php +++ b/app/src/User/UserDb.php @@ -15,10 +15,10 @@ public function __construct(CacheService $cache) public function save(UserEntity $user) { $data = [ - 'uri' => $user->getUri(), - 'username' => $user->getUsername(), - 'slug' => $user->getUsername(), - 'verbose_uri' => $user->getVerboseUri() + 'uri' => $user->getUri(), + 'username' => $user->getUsername(), + 'slug' => $user->getUsername(), + 'verbose_uri' => $user->getVerboseUri() ]; $savedUser = $this->load('uri', $user->getUri()); diff --git a/app/src/User/UserEntity.php b/app/src/User/UserEntity.php index 04f602d19..da0d68e95 100644 --- a/app/src/User/UserEntity.php +++ b/app/src/User/UserEntity.php @@ -174,7 +174,7 @@ public function getAdmin() public function getId() { - $uri = $this->data->uri; + $uri = $this->data->uri; $parts = explode('/', $uri); return $parts[5]; diff --git a/app/src/User/UserFormType.php b/app/src/User/UserFormType.php index 32d505ded..a75cd7249 100644 --- a/app/src/User/UserFormType.php +++ b/app/src/User/UserFormType.php @@ -46,7 +46,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'full_name', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank()], ] ) @@ -54,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'email', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], ] ) @@ -62,7 +62,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'twitter_username', 'text', [ - 'required' => false, + 'required' => false, 'empty_data' => '', // 'constraints' => [new Assert\NotBlank(), new Assert\Email()], ] @@ -71,10 +71,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'biography', 'textarea', [ - 'required' => false, + 'required' => false, 'empty_data' => '', - 'attr' => [ - 'rows' => 4, + 'attr' => [ + 'rows' => 4, 'maxlength' => '400' ] ] @@ -86,7 +86,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'old_password', 'password', [ - 'label' => 'Current password', + 'label' => 'Current password', 'required' => false, // 'constraints' => [new Assert\NotBlank(), new Assert\Email()], ] @@ -95,12 +95,12 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'password', 'repeated', [ - 'type' => 'password', + 'type' => 'password', 'invalid_message' => 'The password fields must match.', - 'required' => false, - 'first_options' => ['label' => 'New password'], - 'second_options' => ['label' => 'Repeat new password'], - 'constraints' => [new Assert\Length(['min' => 6])], + 'required' => false, + 'first_options' => ['label' => 'New password'], + 'second_options' => ['label' => 'Repeat new password'], + 'constraints' => [new Assert\Length(['min' => 6])], ] ); } diff --git a/app/src/User/UsernameInputFormType.php b/app/src/User/UsernameInputFormType.php index af96bdf68..a23df1539 100644 --- a/app/src/User/UsernameInputFormType.php +++ b/app/src/User/UsernameInputFormType.php @@ -39,7 +39,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'username', 'text', [ - 'required' => true, + 'required' => true, 'constraints' => [new Assert\NotBlank()], ] ) diff --git a/tests/Event/EventApiTest.php b/tests/Event/EventApiTest.php index 763901645..ce8be393e 100644 --- a/tests/Event/EventApiTest.php +++ b/tests/Event/EventApiTest.php @@ -15,33 +15,33 @@ class EventApiTest extends TestCase public function setUp(): void { - $this->mockConfig = array('apiUrl' => 'http://example.com'); + $this->mockConfig = ['apiUrl' => 'http://example.com']; $this->mockPredisClient = $this->getMockBuilder(Client::class) ->getMock(); $this->mockCache = $this->getMockBuilder('JoindIn\Web\Application\CacheService') - ->setConstructorArgs(array($this->mockPredisClient)) + ->setConstructorArgs([$this->mockPredisClient]) ->getMock(); $this->mockDbEvent = $this->getMockBuilder('JoindIn\Web\Event\EventDb') - ->setConstructorArgs(array($this->mockCache)) + ->setConstructorArgs([$this->mockCache]) ->getMock(); $this->mockUserDb = $this->getMockBuilder('JoindIn\Web\User\UserDb') - ->setConstructorArgs(array($this->mockCache)) + ->setConstructorArgs([$this->mockCache]) ->getMock(); $this->mockUserApi = $this->getMockBuilder('JoindIn\Web\User\UserApi') - ->setConstructorArgs(array($this->mockConfig, null, $this->mockUserDb)) + ->setConstructorArgs([$this->mockConfig, null, $this->mockUserDb]) ->getMock(); } public function testDefaultgetEventsParametersAreSet(): void { $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock() ; @@ -49,7 +49,7 @@ public function testDefaultgetEventsParametersAreSet(): void $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events', $expectedParams) - ->will($this->returnValue(json_encode(array('events' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['events' => [], 'meta' => []]))); $mockEvent->getEvents(); } @@ -57,15 +57,15 @@ public function testDefaultgetEventsParametersAreSet(): void public function testgetEventsWithLimitSetsParamsCorrectly(): void { $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $expectedParams = ['resultsperpage' => 75, 'start' => 1]; $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events', $expectedParams) - ->will($this->returnValue(json_encode(array('events' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['events' => [], 'meta' => []]))); $mockEvent->getEvents(75); } @@ -73,15 +73,15 @@ public function testgetEventsWithLimitSetsParamsCorrectly(): void public function testgetEventsWithPageValueSetsParamsCorrectly(): void { $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $expectedParams = ['resultsperpage' => 32, 'start' => 6]; $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events', $expectedParams) - ->will($this->returnValue(json_encode(array('events' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['events' => [], 'meta' => []]))); $mockEvent->getEvents(32, 6); } @@ -89,15 +89,15 @@ public function testgetEventsWithPageValueSetsParamsCorrectly(): void public function testgetEventsWithFilterSetsAllParamsCorrectly(): void { $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $expectedParams = ['resultsperpage' => 16, 'start' => 3, 'filter' => 'samoflange']; $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events', $expectedParams) - ->will($this->returnValue(json_encode(array('events' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['events' => [], 'meta' => []]))); $mockEvent->getEvents(16, 3, 'samoflange'); } @@ -105,15 +105,15 @@ public function testgetEventsWithFilterSetsAllParamsCorrectly(): void public function testgetEventsWithVerboseSetsAllParamsCorrectly(): void { $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $expectedParams = ['resultsperpage' => 16, 'start' => 3, 'verbose' => 'yes']; $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events', $expectedParams) - ->will($this->returnValue(json_encode(array('events' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['events' => [], 'meta' => []]))); $mockEvent->getEvents(16, 3, null, true); } @@ -121,17 +121,17 @@ public function testgetEventsWithVerboseSetsAllParamsCorrectly(): void public function testgetEventsWithQueryParamsPassesThemThroughCorrectly(): void { $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $expectedParams = ['resultsperpage' => 16, 'start' => 3, 'title' => 'test', 'tags' => 'php']; $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events', $expectedParams) - ->will($this->returnValue(json_encode(array('events' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['events' => [], 'meta' => []]))); - $mockEvent->getEvents(16, 3, null, false, array('title' => 'test', 'tags' => 'php')); + $mockEvent->getEvents(16, 3, null, false, ['title' => 'test', 'tags' => 'php']); } /** @@ -142,10 +142,10 @@ public function testAddCommentPostsAComment(): void // The object containing the event details (in this case, we only // need to mock the comments_uri and its getter $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') - ->setMethods(array('getCommentsUri')) - ->setConstructorArgs(array( - (object) array('comments_uri'=>'http://example.com/comments/123') - )) + ->setMethods(['getCommentsUri']) + ->setConstructorArgs([ + (object) ['comments_uri' =>'http://example.com/comments/123'] + ]) ->getMock(); $mockEventObj->expects($this->once()) @@ -157,20 +157,20 @@ public function testAddCommentPostsAComment(): void // joind.in API to return a known result and check we're making the // correct call $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiPost')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiPost']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEventApi->expects($this->once()) ->method('apiPost') ->with( 'http://example.com/comments/123', - array( + [ 'comment' => 'comment', - 'rating' => 3, - ) + 'rating' => 3, + ] ) - ->will($this->returnValue(array('201', 'result'))); + ->will($this->returnValue(['201', 'result'])); // The test $this->assertTrue( @@ -186,10 +186,10 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus(): void // The object containing the event details (in this case, we only // need to mock the comments_uri and its getter $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') - ->setMethods(array('getCommentsUri')) - ->setConstructorArgs(array( - (object) array('comments_uri'=>'http://example.com/comments/123') - )) + ->setMethods(['getCommentsUri']) + ->setConstructorArgs([ + (object) ['comments_uri' =>'http://example.com/comments/123'] + ]) ->getMock(); $mockEventObj->expects($this->once()) @@ -201,20 +201,20 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus(): void // joind.in API to return a known (failed) result and check we're making the // correct call $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiPost')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiPost']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEventApi->expects($this->once()) ->method('apiPost') ->with( 'http://example.com/comments/123', - array( + [ 'comment' => 'comment', - 'rating' => 0, - ) + 'rating' => 0, + ] ) - ->will($this->returnValue(array('500', 'no result'))); + ->will($this->returnValue(['500', 'no result'])); // The test $this->expectException('Exception'); @@ -224,10 +224,10 @@ public function testPostCommentThrowsExceptionIfAPIReturnsBadStatus(): void public function testAttendThrowsExceptionIfAPIReturnsBadStatus(): void { $mockEventObj = $this->getMockBuilder('JoindIn\Web\Event\EventEntity') - ->setMethods(array('getApiUriToMarkAsAttending')) - ->setConstructorArgs(array( - (object) array('attending_uri'=>'http://example.com/events/1/attending') - )) + ->setMethods(['getApiUriToMarkAsAttending']) + ->setConstructorArgs([ + (object) ['attending_uri' =>'http://example.com/events/1/attending'] + ]) ->getMock(); $mockEventObj->expects($this->once()) @@ -236,8 +236,8 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus(): void $mockEventApi = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiPost')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiPost']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEventApi->expects($this->once()) @@ -245,7 +245,7 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus(): void ->with( 'http://example.com/events/1/attending' ) - ->will($this->returnValue(array('500', 'no result'))); + ->will($this->returnValue(['500', 'no result'])); $this->expectException('Exception'); $mockEventApi->attend($mockEventObj); @@ -255,14 +255,14 @@ public function testDefaultGetTalkCommentsParametersAreSet(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events/1/talk_comments?resultsperpage=10&start=1') - ->will($this->returnValue(json_encode(array('comments' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['comments' => [], 'meta' => []]))); $mockEvent->getTalkComments($comment_uri); } @@ -271,14 +271,14 @@ public function testGetTalkCommentsWithLimitSetsParamsCorrectly(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events/1/talk_comments?resultsperpage=75&start=1') - ->will($this->returnValue(json_encode(array('comments' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['comments' => [], 'meta' => []]))); $mockEvent->getTalkComments($comment_uri, 75); } @@ -287,14 +287,14 @@ public function testGetTalkCommentsWithStartValueSetsParamsCorrectly(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events/1/talk_comments?resultsperpage=32&start=6') - ->will($this->returnValue(json_encode(array('comments' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['comments' => [], 'meta' => []]))); $mockEvent->getTalkComments($comment_uri, 32, 6); } @@ -303,14 +303,14 @@ public function testGetTalkCommentsWithVerboseSetsAllParamsCorrectly(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') - ->setMethods(array('apiGet')) - ->setConstructorArgs(array($this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi)) + ->setMethods(['apiGet']) + ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); $mockEvent->expects($this->once()) ->method('apiGet') ->with('http://example.com/v2.1/events/1/talk_comments?resultsperpage=16&start=3&verbose=yes') - ->will($this->returnValue(json_encode(array('comments' => array(), 'meta' => array())))); + ->will($this->returnValue(json_encode(['comments' => [], 'meta' => []]))); $mockEvent->getTalkComments($comment_uri, 16, 3, true); } diff --git a/tests/Event/EventCommentEntityTest.php b/tests/Event/EventCommentEntityTest.php index b038091d8..fafa78068 100644 --- a/tests/Event/EventCommentEntityTest.php +++ b/tests/Event/EventCommentEntityTest.php @@ -11,7 +11,7 @@ class EventCommentEntityTest extends TestCase public function setUp(): void { - $this->commentData = new stdClass(); + $this->commentData = new stdClass(); $this->commentData->comment = "Test event comment text"; $this->commentData->user_display_name = "Test comment display name"; $this->commentData->created_date = "2014-03-02T08:43:44+01:00"; diff --git a/tests/Event/EventEntityTest.php b/tests/Event/EventEntityTest.php index 3d421749c..6390f8c0f 100644 --- a/tests/Event/EventEntityTest.php +++ b/tests/Event/EventEntityTest.php @@ -13,28 +13,28 @@ public function setUp(): void { // Not used at the moment, but it's here for future use when we // want to provide data to the class - $this->eventData = new stdClass(); - $this->eventData->name = "Test event name"; - $this->eventData->icon = "Test event icon"; - $this->eventData->start_date = "Test event start date"; - $this->eventData->end_date = "Test event end date"; - $this->eventData->location = "Test event location"; - $this->eventData->description = "Test event description"; - $this->eventData->tags = "Test event tags"; - $this->eventData->latitude = "Test event latitude"; - $this->eventData->longitude = "Test event longitude"; - $this->eventData->href = "Test event href"; - $this->eventData->attendee_count = "Test event attendee count"; - $this->eventData->event_comments_count = "Test event event comments count"; - $this->eventData->comments_uri = "Test event comments uri"; - $this->eventData->talks_uri = "Test event talks uri"; - $this->eventData->uri = "Test event uri"; - $this->eventData->verbose_uri = "Test event verbose uri"; - $this->eventData->attending = "Test event attending"; - $this->eventData->attending_uri = "Test event attending uri"; - $this->eventData->stub = "Test event stub"; - $this->eventData->url_friendly_name = "Test event url friendly name"; - $this->eventData->comments_enabled = "1"; + $this->eventData = new stdClass(); + $this->eventData->name = "Test event name"; + $this->eventData->icon = "Test event icon"; + $this->eventData->start_date = "Test event start date"; + $this->eventData->end_date = "Test event end date"; + $this->eventData->location = "Test event location"; + $this->eventData->description = "Test event description"; + $this->eventData->tags = "Test event tags"; + $this->eventData->latitude = "Test event latitude"; + $this->eventData->longitude = "Test event longitude"; + $this->eventData->href = "Test event href"; + $this->eventData->attendee_count = "Test event attendee count"; + $this->eventData->event_comments_count = "Test event event comments count"; + $this->eventData->comments_uri = "Test event comments uri"; + $this->eventData->talks_uri = "Test event talks uri"; + $this->eventData->uri = "Test event uri"; + $this->eventData->verbose_uri = "Test event verbose uri"; + $this->eventData->attending = "Test event attending"; + $this->eventData->attending_uri = "Test event attending uri"; + $this->eventData->stub = "Test event stub"; + $this->eventData->url_friendly_name = "Test event url friendly name"; + $this->eventData->comments_enabled = "1"; $this->eventData->all_talk_comments_uri = "Test event all talk comments uri"; } diff --git a/tests/Event/EventFormTypeTest.php b/tests/Event/EventFormTypeTest.php index 83b984577..dbe1e737b 100644 --- a/tests/Event/EventFormTypeTest.php +++ b/tests/Event/EventFormTypeTest.php @@ -33,21 +33,21 @@ protected function getExtensions() public function testSubmitValidData() { $formData = [ - "name" => "Community Conference", - "description" => "Conference description.", - "tags" => ["php","conference","web"], - "tz_continent" => "Europe", - "tz_place" => "Amsterdam", - "start_date" => "2019-01-01", - "end_date" => "2019-01-02", - "href" => "https://example.com/2019", + "name" => "Community Conference", + "description" => "Conference description.", + "tags" => ["php", "conference", "web"], + "tz_continent" => "Europe", + "tz_place" => "Amsterdam", + "start_date" => "2019-01-01", + "end_date" => "2019-01-02", + "href" => "https://example.com/2019", "cfp_start_date" => "2019-01-03", - "cfp_end_date" => "2019-01-01", - "cfp_url" => "https://example.com/cfp", - "location" => "Location", - "latitude" => "52.3546273", - "longitude" => "4.8284121", - "new_icon" => null + "cfp_end_date" => "2019-01-01", + "cfp_url" => "https://example.com/cfp", + "location" => "Location", + "latitude" => "52.3546273", + "longitude" => "4.8284121", + "new_icon" => null ]; $form = $this->factory->create(EventFormType::class); @@ -58,7 +58,7 @@ public function testSubmitValidData() $this->assertEquals($formData, $form->getData()); - $view = $form->createView(); + $view = $form->createView(); $children = $view->children; foreach (array_keys($formData) as $key) { diff --git a/tests/Middleware/FormMiddlewareTest.php b/tests/Middleware/FormMiddlewareTest.php index 2884065c9..06c184fbe 100644 --- a/tests/Middleware/FormMiddlewareTest.php +++ b/tests/Middleware/FormMiddlewareTest.php @@ -19,7 +19,7 @@ public function formFactoryIsCreatedCorrectly() $app = $this->createMock(Slim::class); - $validator = $this->createMock(ValidatorInterface::class); + $validator = $this->createMock(ValidatorInterface::class); $app->validator = $validator; $translator = $this->getMockBuilder(Translator::class) diff --git a/web/index.php b/web/index.php index 258eb2722..95958d38a 100644 --- a/web/index.php +++ b/web/index.php @@ -17,7 +17,7 @@ session_cache_limiter(false); session_start(); -$config = array(); +$config = []; $configFile = realpath(__DIR__ . '/../config/config.php'); if (is_readable($configFile)) { include $configFile; @@ -32,9 +32,9 @@ $app = new \Slim\Slim( array_merge( $config['slim'], - array( + [ 'view' => new \Slim\Views\Twig(), - ) + ] ) ); @@ -48,15 +48,15 @@ // Pass the current mode to the template, so we can choose to show // certain things only if the app is in live/development mode $app->view()->appendData( - array('slim_mode' => $config['slim']['mode']) + ['slim_mode' => $config['slim']['mode']] ); // Other variables needed by the main layout.html.twig template $app->view()->appendData( - array( + [ 'google_analytics_id' => $config['slim']['custom']['googleAnalyticsId'], 'user' => (isset($_SESSION['user']) ? $_SESSION['user'] : false), - ) + ] ); // set Twig base folder, view folder and initialize Joindin filters From a96a26b24bb547de5933f476dc613f911ff93226 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 23:00:40 +0200 Subject: [PATCH 40/56] apply codestyle fixes --- app/src/Application/BaseApi.php | 4 ++-- app/src/Client/ClientController.php | 2 +- app/src/Event/EventApi.php | 2 +- app/src/Event/EventController.php | 12 ++++++------ app/src/Event/EventFormType.php | 3 +-- app/src/Event/TrackCollectionFormType.php | 4 ++-- app/src/Search/SearchController.php | 1 - app/src/Talk/TalkApi.php | 6 +++--- app/src/Talk/TalkController.php | 2 +- app/src/Talk/TalkDb.php | 2 +- app/src/User/AuthApi.php | 6 +++--- app/src/User/UserApi.php | 3 +-- app/src/User/UserController.php | 6 +++--- tests/Event/EventApiTest.php | 8 ++++---- tests/Talk/TalkCommentEntityTest.php | 24 +++++++++++------------ web/index.php | 10 ++++------ 16 files changed, 45 insertions(+), 50 deletions(-) diff --git a/app/src/Application/BaseApi.php b/app/src/Application/BaseApi.php index 61925888e..84fa62fed 100644 --- a/app/src/Application/BaseApi.php +++ b/app/src/Application/BaseApi.php @@ -170,12 +170,12 @@ protected function apiPut($url, $params = []) } if ($this->proxy) { - $contextOpts['http']['proxy'] = $this->proxy; + $contextOpts['http']['proxy'] = $this->proxy; $contextOpts['http']['request_fulluri'] = true; } $streamContext = stream_context_create($contextOpts); - $result = file_get_contents($url, 0, $streamContext); + $result = file_get_contents($url, 0, $streamContext); if (false === $result) { throw new Exception('Unable to connect to API'); } diff --git a/app/src/Client/ClientController.php b/app/src/Client/ClientController.php index cfcc89676..b099cf942 100644 --- a/app/src/Client/ClientController.php +++ b/app/src/Client/ClientController.php @@ -224,7 +224,7 @@ public function editClient($username, $clientName) private function addClientUsingForm(Form $form) { $clientApi = $this->getClientApi(); - $values = $form->getData(); + $values = $form->getData(); $result = false; try { diff --git a/app/src/Event/EventApi.php b/app/src/Event/EventApi.php index d52b119f8..d82dbde68 100644 --- a/app/src/Event/EventApi.php +++ b/app/src/Event/EventApi.php @@ -367,7 +367,7 @@ public function uploadIcon($imagesUri, $fileName) ] ]; - $request = new Request('POST', $imagesUri); + $request = new Request('POST', $imagesUri); $response = $client->send($request, $options); } catch (RequestException $e) { $body = $e->getResponse()->getBody(); diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index e7a48ef57..c7ba89878 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -284,9 +284,9 @@ public function comments($friendly_name) $this->render( 'Event/comments.html.twig', [ - 'event' => $event, + 'event' => $event, 'quicklink' => $quicklink, - 'comments' => $comments, + 'comments' => $comments, ] ); } @@ -299,7 +299,7 @@ public function talkComments($friendly_name) $start = ($page -1) * $this->itemsPerPage; $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if ($event) { $comments = $eventApi->getTalkComments( @@ -346,7 +346,7 @@ public function schedule($friendly_name) public function slides($friendly_name) { $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($friendly_name); + $event = $eventApi->getByFriendlyUrl($friendly_name); if (! $event) { $this->redirectToListPage(); @@ -930,7 +930,7 @@ public function moderateComment($friendly_name) $this->redirectToDetailPage($event->getUrlFriendlyName()); } $reported_uri = $this->application->request->post('reported_uri'); - $decision = $this->application->request->post('decision'); + $decision = $this->application->request->post('decision'); $eventApi->moderateComment($reported_uri, $decision); if ($decision == 'approved') { @@ -1133,7 +1133,7 @@ public function editTracks($friendly_name) $values = $form->getdata(); try { - $eventTracksUri = $event->getTracksUri(); + $eventTracksUri = $event->getTracksUri(); $updatedTrackUris = []; foreach ($values['tracks'] as $item) { if ($item['uri']) { diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index a0571c7a7..8c81960cb 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -56,7 +56,6 @@ public function getName() */ public function buildForm(FormBuilderInterface $builder, array $options) { - list($continents, $cities) = $this->getListOfTimezoneContinentsAndCities(); $timezone = null; @@ -264,7 +263,7 @@ public function getListOfTimezoneContinentsAndCities() array_pop($timezones); // Remove UTC from the end of the list $continents = []; - $cities = []; + $cities = []; foreach ($timezones as $timezone) { list($continent, $city) = explode('/', $timezone, 2); diff --git a/app/src/Event/TrackCollectionFormType.php b/app/src/Event/TrackCollectionFormType.php index 1c4309552..de2214956 100644 --- a/app/src/Event/TrackCollectionFormType.php +++ b/app/src/Event/TrackCollectionFormType.php @@ -36,8 +36,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'tracks', 'collection', [ - 'type' => new TrackFormType(), - 'allow_add' => true, + 'type' => new TrackFormType(), + 'allow_add' => true, 'allow_delete' => true, ] ) diff --git a/app/src/Search/SearchController.php b/app/src/Search/SearchController.php index 8f836b7d7..9940ae9eb 100644 --- a/app/src/Search/SearchController.php +++ b/app/src/Search/SearchController.php @@ -71,7 +71,6 @@ protected function sanitizeTag($tag) */ public function searchEvents() { - $keyword = $this->sanitizeKeyword($this->application->request()->get('keyword')); $tag = $this->sanitizeTag($this->application->request()->get('tag')); $events = []; diff --git a/app/src/Talk/TalkApi.php b/app/src/Talk/TalkApi.php index ab40e89d2..5359f8502 100644 --- a/app/src/Talk/TalkApi.php +++ b/app/src/Talk/TalkApi.php @@ -3,7 +3,6 @@ use JoindIn\Web\Application\BaseApi; use Exception; -use Talk\Comment; use JoindIn\Web\User\UserApi; class TalkApi extends BaseApi @@ -493,7 +492,7 @@ protected function addTalkMedia($talkId, $media) } $talkUrl = $this->baseApiUrl . '/v2.1/talks/' . $talkId . '/links'; - $params = [ + $params = [ 'display_name' => $media['type'], 'url' => $media['url'], ]; @@ -509,7 +508,7 @@ protected function addTalkMedia($talkId, $media) protected function updateTalkMedia($talkId, $mediaId, $media) { $talkUrl = $this->baseApiUrl . '/v2.1/talks/' . $talkId . '/links/' . $mediaId; - $params = [ + $params = [ 'display_name' => $media['type'], 'url' => $media['url'], ]; @@ -524,6 +523,7 @@ protected function updateTalkMedia($talkId, $mediaId, $media) protected function deleteTalkMedia($talkId, $mediaId) { $talkUrl = $this->baseApiUrl . '/v2.1/talks/' . $talkId . '/links/' . $mediaId; + list($status, $result, $headers) = $this->apiDelete($talkUrl); if ($status == 204) { diff --git a/app/src/Talk/TalkController.php b/app/src/Talk/TalkController.php index 1f84ec4af..e6889799f 100644 --- a/app/src/Talk/TalkController.php +++ b/app/src/Talk/TalkController.php @@ -518,7 +518,7 @@ public function deleteTalk($eventSlug, $talkSlug) } $eventApi = $this->getEventApi(); - $event = $eventApi->getByFriendlyUrl($eventSlug); + $event = $eventApi->getByFriendlyUrl($eventSlug); if (! $event->getCanEdit()) { $this->application->redirect( diff --git a/app/src/Talk/TalkDb.php b/app/src/Talk/TalkDb.php index 0a4d221d4..a0c21ad25 100644 --- a/app/src/Talk/TalkDb.php +++ b/app/src/Talk/TalkDb.php @@ -16,7 +16,7 @@ public function getUriFor($slug, $eventUri) { $data = $this->cache->loadByKeys($this->keyName, [ 'event_uri' => $eventUri, - 'slug' => $slug + 'slug' => $slug ]); if ($data) { diff --git a/app/src/User/AuthApi.php b/app/src/User/AuthApi.php index ec33dd8a2..444710bc3 100644 --- a/app/src/User/AuthApi.php +++ b/app/src/User/AuthApi.php @@ -16,7 +16,7 @@ class AuthApi extends BaseApi */ public function login($username, $password, $clientId, $clientSecret) { - $url = $this->baseApiUrl . '/v2.1/token'; + $url = $this->baseApiUrl . '/v2.1/token'; $params = [ 'grant_type' => 'password', 'client_id' => $clientId, @@ -44,7 +44,7 @@ public function login($username, $password, $clientId, $clientSecret) */ public function getTwitterRequestToken($clientId, $clientSecret) { - $url = $this->baseApiUrl . '/v2.1/twitter/request_token'; + $url = $this->baseApiUrl . '/v2.1/twitter/request_token'; $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, @@ -70,7 +70,7 @@ public function getTwitterRequestToken($clientId, $clientSecret) */ public function verifyTwitter($clientId, $clientSecret, $token, $verifier) { - $url = $this->baseApiUrl . '/v2.1/twitter/token'; + $url = $this->baseApiUrl . '/v2.1/twitter/token'; $params = [ 'client_id' => $clientId, 'client_secret' => $clientSecret, diff --git a/app/src/User/UserApi.php b/app/src/User/UserApi.php index 8256ae7c5..efa6bc81b 100644 --- a/app/src/User/UserApi.php +++ b/app/src/User/UserApi.php @@ -69,7 +69,6 @@ public function getUserByUserId($userId) */ public function register($data) { - list($status, $result, $headers) = $this->apiPost($this->baseApiUrl . '/v2.1/users', $data); if ($status == 201) { @@ -323,7 +322,7 @@ public function resetPassword($token, $password) public function getCollection(array $queryParams = []) { $usersUri = $this->baseApiUrl . '/v2.1/users'; - $users = (array)json_decode( + $users = (array)json_decode( $this->apiGet($usersUri, $queryParams) ); $meta = array_pop($users); diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index 16f63f7db..902169dea 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -258,7 +258,7 @@ public function resendVerification() public function profile($username) { $userApi = $this->getUserApi(); - $user = $userApi->getUserByUsername($username); + $user = $userApi->getUserByUsername($username); if (!$user) { Slim::getInstance()->notFound(); } @@ -516,12 +516,12 @@ protected function lookupEventInfo($eventUri) $eventData = $eventDb->load('uri', $eventUri); if (isset($eventData['name'])) { $eventInfo['url_friendly_name'] = $eventData['url_friendly_name']; - $eventInfo['name'] = $eventData['name']; + $eventInfo['name'] = $eventData['name']; } else { $event = $eventApi->getEvent($eventUri); if ($event) { $eventInfo['url_friendly_name'] = $event->getUrlFriendlyName(); - $eventInfo['name'] = $event->getName(); + $eventInfo['name'] = $event->getName(); } } diff --git a/tests/Event/EventApiTest.php b/tests/Event/EventApiTest.php index ce8be393e..9a5e1d3df 100644 --- a/tests/Event/EventApiTest.php +++ b/tests/Event/EventApiTest.php @@ -254,7 +254,7 @@ public function testAttendThrowsExceptionIfAPIReturnsBadStatus(): void public function testDefaultGetTalkCommentsParametersAreSet(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(['apiGet']) ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); @@ -270,7 +270,7 @@ public function testDefaultGetTalkCommentsParametersAreSet(): void public function testGetTalkCommentsWithLimitSetsParamsCorrectly(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(['apiGet']) ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); @@ -286,7 +286,7 @@ public function testGetTalkCommentsWithLimitSetsParamsCorrectly(): void public function testGetTalkCommentsWithStartValueSetsParamsCorrectly(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(['apiGet']) ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); @@ -302,7 +302,7 @@ public function testGetTalkCommentsWithStartValueSetsParamsCorrectly(): void public function testGetTalkCommentsWithVerboseSetsAllParamsCorrectly(): void { $comment_uri = 'http://example.com/v2.1/events/1/talk_comments'; - $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') + $mockEvent = $this->getMockBuilder('JoindIn\Web\Event\EventApi') ->setMethods(['apiGet']) ->setConstructorArgs([$this->mockConfig, null, $this->mockDbEvent, $this->mockUserApi]) ->getMock(); diff --git a/tests/Talk/TalkCommentEntityTest.php b/tests/Talk/TalkCommentEntityTest.php index 50512235a..dbb12f632 100644 --- a/tests/Talk/TalkCommentEntityTest.php +++ b/tests/Talk/TalkCommentEntityTest.php @@ -11,18 +11,18 @@ class TalkCommentEntityTest extends TestCase public function setUp(): void { - $this->commentData = new stdClass(); - $this->commentData->rating = 5; - $this->commentData->comment = "Test event comment text"; - $this->commentData->user_display_name = "Test comment display name"; - $this->commentData->talk_title = "Test talk title"; - $this->commentData->created_date = "2014-03-02T08:43:44+01:00"; - $this->commentData->uri = "Test comment uri"; - $this->commentData->verbose_uri = "Test comment verbose uri"; - $this->commentData->talk_uri = "Test talk uri"; - $this->commentData->talk_comments_uri = "Test comments uri"; - $this->commentData->user_uri = "Test user uri"; - $this->commentData->source = "Test comment source"; + $this->commentData = new stdClass(); + $this->commentData->rating = 5; + $this->commentData->comment = "Test event comment text"; + $this->commentData->user_display_name = "Test comment display name"; + $this->commentData->talk_title = "Test talk title"; + $this->commentData->created_date = "2014-03-02T08:43:44+01:00"; + $this->commentData->uri = "Test comment uri"; + $this->commentData->verbose_uri = "Test comment verbose uri"; + $this->commentData->talk_uri = "Test talk uri"; + $this->commentData->talk_comments_uri = "Test comments uri"; + $this->commentData->user_uri = "Test user uri"; + $this->commentData->source = "Test comment source"; } public function testBasicCommentsData(): void diff --git a/web/index.php b/web/index.php index 95958d38a..d1db75b84 100644 --- a/web/index.php +++ b/web/index.php @@ -52,12 +52,10 @@ ); // Other variables needed by the main layout.html.twig template -$app->view()->appendData( - [ - 'google_analytics_id' => $config['slim']['custom']['googleAnalyticsId'], - 'user' => (isset($_SESSION['user']) ? $_SESSION['user'] : false), - ] -); +$app->view()->appendData([ + 'google_analytics_id' => $config['slim']['custom']['googleAnalyticsId'], + 'user' => (isset($_SESSION['user']) ? $_SESSION['user'] : false), +]); // set Twig base folder, view folder and initialize Joindin filters $app->view()->parserDirectory = realpath(__DIR__ . '/../vendor/Twig/lib/Twig'); From 87f4130a8fb488ad7fb1360a524b95236e55c461 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 23:18:25 +0200 Subject: [PATCH 41/56] remove unneeded preceding backslashed --- web/index.php | 96 +++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/web/index.php b/web/index.php index 281e29ccd..d42718e43 100644 --- a/web/index.php +++ b/web/index.php @@ -27,14 +27,14 @@ } // Wrap the Config Data with the Application Config object -$config['slim']['custom'] = new \JoindIn\Web\Application\Config($config['slim']['custom']); +$config['slim']['custom'] = new JoindIn\Web\Application\Config($config['slim']['custom']); // initialize Slim -$app = new \Slim\Slim( +$app = new Slim\Slim( array_merge( $config['slim'], [ - 'view' => new \Slim\Views\Twig(), + 'view' => new Slim\Views\Twig(), ] ) ); @@ -62,9 +62,9 @@ $app->view()->parserDirectory = realpath(__DIR__ . '/../vendor/Twig/lib/Twig'); $app->view()->setTemplatesDirectory('../app/templates'); -$app->view()->getEnvironment()->addExtension(new \JoindIn\Web\View\FiltersExtension()); -$app->view()->getEnvironment()->addExtension(new \Slim\Views\TwigExtension()); -$app->view()->getEnvironment()->addExtension(new \JoindIn\Web\View\FunctionsExtension($app)); +$app->view()->getEnvironment()->addExtension(new JoindIn\Web\View\FiltersExtension()); +$app->view()->getEnvironment()->addExtension(new Slim\Views\TwigExtension()); +$app->view()->getEnvironment()->addExtension(new JoindIn\Web\View\FunctionsExtension($app)); if (isset($config['slim']['twig']['cache'])) { $app->view()->getEnvironment()->setCache($config['slim']['twig']['cache']); @@ -75,11 +75,11 @@ $app->configureMode('development', function () use ($app) { $env = $app->view()->getEnvironment(); $env->enableDebug(); - $env->addExtension(new \Twig_Extension_Debug()); + $env->addExtension(new Twig_Extension_Debug()); }); // register error handlers -$app->error(function (\Exception $e) use ($app) { +$app->error(function (Exception $e) use ($app) { error_log(get_class($e) . ': ' . $e->getMessage() . " -- " . $e->getTraceAsString()); $app->render('Error/error.html.twig', ['exception' => $e]); }); @@ -89,18 +89,18 @@ }); // register middlewares -$app->add(new \JoindIn\Web\Middleware\ValidationMiddleware()); +$app->add(new JoindIn\Web\Middleware\ValidationMiddleware()); $csrfSecret = null; if (!empty($config['slim']['custom']['csrfSecret'])) { $csrfSecret = $config['slim']['custom']['csrfSecret']; } -$app->add(new \JoindIn\Web\Middleware\FormMiddleware($csrfSecret)); +$app->add(new JoindIn\Web\Middleware\FormMiddleware($csrfSecret)); // register services $app->container->set('access_token', isset($_SESSION['access_token']) ? $_SESSION['access_token'] : null); -$app->container->singleton(\JoindIn\Web\Application\CacheService::class, function ($container) { +$app->container->singleton(JoindIn\Web\Application\CacheService::class, function ($container) { $redis = $container->settings['custom']['redis']; $prefix = $redis['options']['prefix']; @@ -109,67 +109,67 @@ } $client = new Predis\Client($redis['connection']); - return new \JoindIn\Web\Application\CacheService($client, $prefix); + return new JoindIn\Web\Application\CacheService($client, $prefix); }); -$app->container->singleton(\JoindIn\Web\Application\ContactApi::class, function ($container) { - return new \JoindIn\Web\Application\ContactApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(JoindIn\Web\Application\ContactApi::class, function ($container) { + return new JoindIn\Web\Application\ContactApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\JoindIn\Web\User\UserDb::class, function ($container) { - return new \JoindIn\Web\User\UserDb($container[\JoindIn\Web\Application\CacheService::class]); +$app->container->singleton(JoindIn\Web\User\UserDb::class, function ($container) { + return new JoindIn\Web\User\UserDb($container[JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\JoindIn\Web\User\UserApi::class, function ($container) { - return new \JoindIn\Web\User\UserApi( +$app->container->singleton(JoindIn\Web\User\UserApi::class, function ($container) { + return new JoindIn\Web\User\UserApi( $container['settings']['custom'], $container['access_token'], - $container[\JoindIn\Web\User\UserDb::class] + $container[JoindIn\Web\User\UserDb::class] ); }); -$app->container->singleton(\JoindIn\Web\Event\EventDb::class, function ($container) { - return new \JoindIn\Web\Event\EventDb($container[\JoindIn\Web\Application\CacheService::class]); +$app->container->singleton(JoindIn\Web\Event\EventDb::class, function ($container) { + return new JoindIn\Web\Event\EventDb($container[JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\JoindIn\Web\Event\EventApi::class, function ($container) { - return new \JoindIn\Web\Event\EventApi( +$app->container->singleton(JoindIn\Web\Event\EventApi::class, function ($container) { + return new JoindIn\Web\Event\EventApi( $container['settings']['custom'], $container['access_token'], - $container[\JoindIn\Web\Event\EventDb::class], - $container[\JoindIn\Web\User\UserApi::class] + $container[JoindIn\Web\Event\EventDb::class], + $container[JoindIn\Web\User\UserApi::class] ); }); -$app->container->singleton(\JoindIn\Web\Talk\TalkDb::class, function ($container) { - return new \JoindIn\Web\Talk\TalkDb($container[\JoindIn\Web\Application\CacheService::class]); +$app->container->singleton(JoindIn\Web\Talk\TalkDb::class, function ($container) { + return new JoindIn\Web\Talk\TalkDb($container[JoindIn\Web\Application\CacheService::class]); }); -$app->container->singleton(\JoindIn\Web\Talk\TalkApi::class, function ($container) { - return new \JoindIn\Web\Talk\TalkApi( +$app->container->singleton(JoindIn\Web\Talk\TalkApi::class, function ($container) { + return new JoindIn\Web\Talk\TalkApi( $container['settings']['custom'], $container['access_token'], - new \JoindIn\Web\Talk\TalkDb($container[\JoindIn\Web\Application\CacheService::class]), - $container[\JoindIn\Web\User\UserApi::class] + new JoindIn\Web\Talk\TalkDb($container[JoindIn\Web\Application\CacheService::class]), + $container[JoindIn\Web\User\UserApi::class] ); }); -$app->container->singleton(\JoindIn\Web\User\AuthApi::class, function ($container) { - return new \JoindIn\Web\User\AuthApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(JoindIn\Web\User\AuthApi::class, function ($container) { + return new JoindIn\Web\User\AuthApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\JoindIn\Web\Language\LanguageApi::class, function ($container) { - return new \JoindIn\Web\Language\LanguageApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(JoindIn\Web\Language\LanguageApi::class, function ($container) { + return new JoindIn\Web\Language\LanguageApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\JoindIn\Web\Talk\TalkTypeApi::class, function ($container) { - return new \JoindIn\Web\Talk\TalkTypeApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(JoindIn\Web\Talk\TalkTypeApi::class, function ($container) { + return new JoindIn\Web\Talk\TalkTypeApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\JoindIn\Web\Event\TrackApi::class, function ($container) { - return new \JoindIn\Web\Event\TrackApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(JoindIn\Web\Event\TrackApi::class, function ($container) { + return new JoindIn\Web\Event\TrackApi($container['settings']['custom'], $container['access_token']); }); -$app->container->singleton(\JoindIn\Web\Client\ClientApi::class, function ($container) { - return new \JoindIn\Web\Client\ClientApi($container['settings']['custom'], $container['access_token']); +$app->container->singleton(JoindIn\Web\Client\ClientApi::class, function ($container) { + return new JoindIn\Web\Client\ClientApi($container['settings']['custom'], $container['access_token']); }); // register routes -new \JoindIn\Web\Application\ApplicationController($app); -new \JoindIn\Web\Event\EventController($app); -new \JoindIn\Web\Search\SearchController($app); -new \JoindIn\Web\User\UserController($app); -new \JoindIn\Web\Talk\TalkController($app); -new \JoindIn\Web\Client\ClientController($app); -new \JoindIn\Web\Apikey\ApikeyController($app); +new JoindIn\Web\Application\ApplicationController($app); +new JoindIn\Web\Event\EventController($app); +new JoindIn\Web\Search\SearchController($app); +new JoindIn\Web\User\UserController($app); +new JoindIn\Web\Talk\TalkController($app); +new JoindIn\Web\Client\ClientController($app); +new JoindIn\Web\Apikey\ApikeyController($app); // execute application $app->run(); From 75091fcf9f5bcbe23aa58e437cb751bac4daf969 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 23:23:31 +0200 Subject: [PATCH 42/56] fix config test --- tests/Application/ConfigTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/Application/ConfigTest.php b/tests/Application/ConfigTest.php index 6b035d4e6..601f682be 100644 --- a/tests/Application/ConfigTest.php +++ b/tests/Application/ConfigTest.php @@ -1,7 +1,8 @@ config = new Config( [ - 'db' => 'mysql', - 'engine' => 'fast', - 'testing' => true, + 'db' => 'mysql', + 'engine' => 'fast', + 'testing' => true, 'another setting' => 17, ] ); @@ -45,7 +46,7 @@ public function testConfigExistsReturnsCorrectBool(): void public function testConfigCanGetSetting($settings, $key, $expected): void { $config = new Config($settings); - $value = $config->offsetGet($key); + $value = $config->offsetGet($key); $this->assertEquals($expected, $value); } From ff25b5a5150c7ed0764150633d536a45cabfd2de Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 23:32:51 +0200 Subject: [PATCH 43/56] optimize imports --- .../Application/BaseCommentReportingEntity.php | 1 - app/src/Application/BaseController.php | 4 ++-- app/src/Application/BaseDb.php | 2 -- app/src/Client/ClientDeleteFormType.php | 2 -- app/src/Client/ClientEntity.php | 2 -- app/src/Client/ClientFormType.php | 1 - app/src/Event/EventApi.php | 4 ++-- app/src/Event/EventController.php | 17 +++++++---------- app/src/Event/EventEntity.php | 2 +- app/src/Event/EventFormType.php | 4 ++-- app/src/Event/TrackCollectionFormType.php | 1 - .../Form/DataTransformer/DateTransformer.php | 4 ++-- app/src/Middleware/ValidationMiddleware.php | 12 ++++++------ app/src/Talk/TalkApi.php | 2 +- app/src/Talk/TalkCommentEntity.php | 1 - app/src/Talk/TalkDeleteFormType.php | 2 -- app/src/Talk/TalkEntity.php | 2 +- app/src/Talk/TalkFormType.php | 12 ++++++------ app/src/User/UserController.php | 12 ++++++------ 19 files changed, 36 insertions(+), 51 deletions(-) diff --git a/app/src/Application/BaseCommentReportingEntity.php b/app/src/Application/BaseCommentReportingEntity.php index b24748349..5d932e49c 100644 --- a/app/src/Application/BaseCommentReportingEntity.php +++ b/app/src/Application/BaseCommentReportingEntity.php @@ -1,7 +1,6 @@ application->render($template, $data, $status); - } catch (Twig_Error_Runtime $e) { + } catch (RuntimeError $e) { $this->application->render( 'Error/app_load_error.html.twig', [ diff --git a/app/src/Application/BaseDb.php b/app/src/Application/BaseDb.php index 4a19f3d36..7c4111da9 100644 --- a/app/src/Application/BaseDb.php +++ b/app/src/Application/BaseDb.php @@ -1,8 +1,6 @@ setMetadataFactory(new LazyLoadingMetadataFactory(new StaticMethodLoader())) - ->setConstraintValidatorFactory(new ConstraintValidatorFactory()) - ->setTranslator($this->getTranslator()) - ->getValidator(); + ->setMetadataFactory(new LazyLoadingMetadataFactory(new StaticMethodLoader())) + ->setConstraintValidatorFactory(new ConstraintValidatorFactory()) + ->setTranslator($this->getTranslator()) + ->getValidator(); return $validator; } @@ -112,7 +112,7 @@ private function addTranslations($translator, $validatorComponentRootFolder) */ private function getTranslator() { - if (!$this->app->translator instanceof Translator) { + if ( ! $this->app->translator instanceof Translator) { $this->app->translator = new Translator($this->locale, new MessageSelector()); $this->app->translator->addLoader('array', new ArrayLoader()); $this->app->translator->addLoader('xliff', new XliffFileLoader()); diff --git a/app/src/Talk/TalkApi.php b/app/src/Talk/TalkApi.php index 5359f8502..739493da0 100644 --- a/app/src/Talk/TalkApi.php +++ b/app/src/Talk/TalkApi.php @@ -1,8 +1,8 @@ timezone = $event->getFullTimezone(); $tz = new \DateTimeZone($this->timezone); - $this->startDate = new \DateTimeImmutable($event->getStartDate(), $tz); - $this->endDate = new \DateTimeImmutable($event->getEndDate(), $tz); + $this->startDate = new DateTimeImmutable($event->getStartDate(), $tz); + $this->endDate = new DateTimeImmutable($event->getEndDate(), $tz); $this->languages = $languages; $this->talkTypes = $talkTypes; diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index 902169dea..3deb55764 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -2,14 +2,14 @@ namespace JoindIn\Web\User; use JoindIn\Web\Application\BaseController; -use Symfony\Component\Form\FormError; -use Slim\Slim; -use JoindIn\Web\Talk\TalkDb; -use JoindIn\Web\Talk\TalkApi; -use JoindIn\Web\Event\EventDb; use JoindIn\Web\Event\EventApi; -use Symfony\Component\Form\FormFactoryInterface; +use JoindIn\Web\Event\EventDb; +use JoindIn\Web\Talk\TalkApi; +use JoindIn\Web\Talk\TalkDb; +use Slim\Slim; use stdClass; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; class UserController extends BaseController From 93dc846e8ec4c460cc759e4f8cd4b4c94b4254bb Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Mon, 3 Jun 2019 23:34:40 +0200 Subject: [PATCH 44/56] apply codestyle fix --- app/src/Middleware/ValidationMiddleware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/Middleware/ValidationMiddleware.php b/app/src/Middleware/ValidationMiddleware.php index fa801fb3c..bf70032b9 100644 --- a/app/src/Middleware/ValidationMiddleware.php +++ b/app/src/Middleware/ValidationMiddleware.php @@ -112,7 +112,7 @@ private function addTranslations($translator, $validatorComponentRootFolder) */ private function getTranslator() { - if ( ! $this->app->translator instanceof Translator) { + if (!$this->app->translator instanceof Translator) { $this->app->translator = new Translator($this->locale, new MessageSelector()); $this->app->translator->addLoader('array', new ArrayLoader()); $this->app->translator->addLoader('xliff', new XliffFileLoader()); From 28d2fef1d56899b7e2a9ed0f1326441e645bfd63 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Fri, 7 Jun 2019 20:43:03 +0200 Subject: [PATCH 45/56] cleanup imports --- app/src/Application/BaseCommentEntity.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/Application/BaseCommentEntity.php b/app/src/Application/BaseCommentEntity.php index 0a03a4522..2ed532816 100644 --- a/app/src/Application/BaseCommentEntity.php +++ b/app/src/Application/BaseCommentEntity.php @@ -1,8 +1,6 @@ Date: Sat, 8 Jun 2019 14:37:25 -0500 Subject: [PATCH 46/56] Yes, PhpStorm, we need ext-json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 00fddee92..243f093f4 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,8 @@ "symfony/validator": "~2.8", "symfony/security-csrf": "~2.8", "symfony/twig-bridge": "~2.8", - "twig/twig": "~1.15" + "twig/twig": "~1.15", + "ext-json": "*" }, "require-dev": { "jakub-onderka/php-parallel-lint": "^1.0", From 7fbb43e92369a7c119a21cc1e63738262fd08d1e Mon Sep 17 00:00:00 2001 From: Ian Littman Date: Sat, 8 Jun 2019 14:45:43 -0500 Subject: [PATCH 47/56] Explicitly return null when a false-y event ID is passed --- app/src/Event/EventApi.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/Event/EventApi.php b/app/src/Event/EventApi.php index 2894f8eec..ac296be1d 100644 --- a/app/src/Event/EventApi.php +++ b/app/src/Event/EventApi.php @@ -137,7 +137,7 @@ public function getEventById($eventId) { $eventId = (int)$eventId; if (!$eventId) { - return; + return null; } $eventUrl = $this->baseApiUrl . '/v2.1/events/' . $eventId; @@ -510,7 +510,7 @@ public function getPendingClaims($claims_uri, $verbose = false) $claims_uri = $claims_uri . "?verbose=yes"; } $response = json_decode($this->apiGet($claims_uri)); - + $reports = []; foreach ($response->claims as $item) { From 1e4069538f30019fca155832bb979bacd323f0f5 Mon Sep 17 00:00:00 2001 From: Ian Littman Date: Sat, 8 Jun 2019 14:49:25 -0500 Subject: [PATCH 48/56] Fix typo in approveClaimPendingTalk --- app/src/Event/EventController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/Event/EventController.php b/app/src/Event/EventController.php index 2f2900ef6..012be024e 100644 --- a/app/src/Event/EventController.php +++ b/app/src/Event/EventController.php @@ -980,7 +980,7 @@ public function talkClaims($friendly_name) ]; if ($action == "approve") { - $this->appoveClaimPendingTalk($talkApi, $claim, $data); + $this->approveClaimPendingTalk($talkApi, $claim, $data); } elseif ($action == "reject") { $this->rejectClaimPendingTalk($talkApi, $claim, $data); } @@ -996,7 +996,8 @@ public function talkClaims($friendly_name) ); } } - private function appoveClaimPendingTalk(TalkApi $talkApi, $claim, $data) + + private function approveClaimPendingTalk(TalkApi $talkApi, $claim, $data) { $talkApi->claimTalk($claim->approve_claim_uri, $data); From 9dfc66066bb3bde7e0057b3cde9307a00d129747 Mon Sep 17 00:00:00 2001 From: Ian Littman Date: Sat, 8 Jun 2019 15:00:19 -0500 Subject: [PATCH 49/56] Remove redundant/misleading echos on $this->render() calls --- app/src/User/UserController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/User/UserController.php b/app/src/User/UserController.php index 3deb55764..422d6a697 100644 --- a/app/src/User/UserController.php +++ b/app/src/User/UserController.php @@ -325,7 +325,7 @@ public function profile($username) } } - echo $this->render( + $this->render( 'User/profile.html.twig', [ 'thisUser' => $user, @@ -371,7 +371,7 @@ public function profileTalks($username) } } - echo $this->render( + $this->render( 'User/profile-talks.html.twig', [ 'thisUser' => $user, @@ -404,7 +404,7 @@ public function profileEvents($username) $this->application->redirect($this->application->urlFor('user-profile', ['username' => $username])); } - echo $this->render( + $this->render( 'User/profile-events.html.twig', [ 'thisUser' => $user, @@ -438,7 +438,7 @@ public function profileHosted($username) } - echo $this->render( + $this->render( 'User/profile-events.html.twig', [ 'thisUser' => $user, From 0ab7002d99a0c5889679a1bed8ba44fcd97832ef Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 14:49:29 +0200 Subject: [PATCH 50/56] make formtype compatible with symfony/form 3.4 --- app/src/Application/ContactFormType.php | 12 ++++--- app/src/Client/ClientDeleteFormType.php | 3 +- app/src/Client/ClientFormType.php | 9 ++++-- app/src/Event/EventFormType.php | 38 +++++++++++++---------- app/src/Event/TrackCollectionFormType.php | 3 +- app/src/Event/TrackFormType.php | 9 ++++-- app/src/Talk/SpeakerFormType.php | 3 +- app/src/Talk/TalkDeleteFormType.php | 3 +- app/src/Talk/TalkFormType.php | 24 ++++++++------ app/src/Talk/TalkMediaFormType.php | 6 ++-- app/src/User/EmailInputFormType.php | 3 +- app/src/User/NewPasswordFormType.php | 3 +- app/src/User/RegisterFormType.php | 15 +++++---- app/src/User/UserFormType.php | 16 ++++++---- app/src/User/UsernameInputFormType.php | 3 +- 15 files changed, 93 insertions(+), 57 deletions(-) diff --git a/app/src/Application/ContactFormType.php b/app/src/Application/ContactFormType.php index 4784bf1cd..378c7480f 100644 --- a/app/src/Application/ContactFormType.php +++ b/app/src/Application/ContactFormType.php @@ -3,6 +3,8 @@ namespace JoindIn\Web\Application; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -56,7 +58,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'name', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 100])], 'max_length' => '100', @@ -64,7 +66,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'email', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], @@ -72,7 +74,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'subject', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 100])], 'max_length' => '100', @@ -80,7 +82,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'comment', - 'textarea', + TextareaType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank()], @@ -88,7 +90,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'phone', - 'text', + TextType::class, [ 'constraints' => [new Assert\Blank()], ] diff --git a/app/src/Client/ClientDeleteFormType.php b/app/src/Client/ClientDeleteFormType.php index fe28fe085..8e0b5ac69 100644 --- a/app/src/Client/ClientDeleteFormType.php +++ b/app/src/Client/ClientDeleteFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\Client; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -34,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'client_id', - 'hidden', + HiddenType::class, [] ) ; diff --git a/app/src/Client/ClientFormType.php b/app/src/Client/ClientFormType.php index 48773c8d7..a7e2586ac 100644 --- a/app/src/Client/ClientFormType.php +++ b/app/src/Client/ClientFormType.php @@ -3,6 +3,9 @@ namespace JoindIn\Web\Client; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -35,14 +38,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'application', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank()], ] ) ->add( 'description', - 'textarea', + TextareaType::class, [ 'constraints' => [new Assert\NotBlank()], 'attr' => ['rows' => '10'] @@ -50,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'callback_url', - 'url', + UrlType::class, [ 'constraints' => [ new Assert\Url(), diff --git a/app/src/Event/EventFormType.php b/app/src/Event/EventFormType.php index 401a7fd3b..908cf4cb6 100644 --- a/app/src/Event/EventFormType.php +++ b/app/src/Event/EventFormType.php @@ -6,6 +6,12 @@ use JoindIn\Web\Form\DataTransformer\DateTransformer; use JoindIn\Web\Form\DataTransformer\EventTagsTransformer; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -65,17 +71,17 @@ public function buildForm(FormBuilderInterface $builder, array $options) $dateTransformer = new DateTransformer($timezone); $builder - ->add('addr', 'hidden', ['mapped' => false]) + ->add('addr', HiddenType::class, ['mapped' => false]) ->add( 'name', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 5])], ] ) ->add( 'description', - 'textarea', + TextareaType::class, [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 5])], 'attr' => [ @@ -86,7 +92,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( $builder->create( 'tags', - 'text', + TextType::class, [ 'required' => false, 'attr' => ['placeholder' => 'comma separated, tag, list'] @@ -95,7 +101,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'tz_continent', - 'choice', + ChoiceType::class, [ 'label' => 'Timezone', 'choices' => array_merge(["Select a continent"], $continents), @@ -104,7 +110,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'tz_place', - 'choice', + ChoiceType::class, [ 'label' => 'Timezone city', 'choices' => array_merge(['Select a city'], $cities), @@ -114,36 +120,36 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add( $builder->create( 'start_date', - 'text', + TextType::class, $this->getOptionsForDateWidget('Start date') )->addViewTransformer($dateTransformer) ) ->add( $builder->create( 'end_date', - 'text', + TextType::class, $this->getOptionsForDateWidget('End date') )->addViewTransformer($dateTransformer) ) - ->add('href', 'url', $this->getOptionsForUrlWidget('Website URL')) + ->add('href', UrlType::class, $this->getOptionsForUrlWidget('Website URL')) ->add( $builder->create( 'cfp_start_date', - 'text', + TextType::class, $this->getOptionsForDateWidget('Opening date', false) )->addViewTransformer($dateTransformer) ) ->add( $builder->create( 'cfp_end_date', - 'text', + TextType::class, $this->getOptionsForDateWidget('Closing date', false) )->addViewTransformer($dateTransformer) ) - ->add('cfp_url', 'url', $this->getOptionsForUrlWidget('Call for papers URL', false)) + ->add('cfp_url', UrlType::class, $this->getOptionsForUrlWidget('Call for papers URL', false)) ->add( 'location', - 'text', + TextType::class, [ 'label' => 'Venue name', 'constraints' => [new Assert\NotBlank()], @@ -151,7 +157,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'latitude', - 'text', + TextType::class, [ 'label' => 'Latitude', 'attr' => ['readonly' => 'readonly'], @@ -159,7 +165,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'longitude', - 'text', + TextType::class, [ 'label' => 'Longitude', 'attr' => ['readonly' => 'readonly'], @@ -167,7 +173,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'new_icon', - 'file', + FileType::class, [ 'data_class' => null, 'label' => 'Upload new icon', diff --git a/app/src/Event/TrackCollectionFormType.php b/app/src/Event/TrackCollectionFormType.php index 2d59ad0c5..3671ca590 100644 --- a/app/src/Event/TrackCollectionFormType.php +++ b/app/src/Event/TrackCollectionFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\Event; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -33,7 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'tracks', - 'collection', + CollectionType::class, [ 'type' => new TrackFormType(), 'allow_add' => true, diff --git a/app/src/Event/TrackFormType.php b/app/src/Event/TrackFormType.php index c7ff69c0f..26d71fd36 100644 --- a/app/src/Event/TrackFormType.php +++ b/app/src/Event/TrackFormType.php @@ -3,6 +3,9 @@ namespace JoindIn\Web\Event; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -34,21 +37,21 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'uri', - 'hidden', + HiddenType::class, [ 'required' => false, ] ) ->add( 'track_name', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank()], ] ) ->add( 'track_description', - 'textarea', + TextareaType::class, [ 'constraints' => [new Assert\NotBlank()], 'attr' => ['rows' => '2'] diff --git a/app/src/Talk/SpeakerFormType.php b/app/src/Talk/SpeakerFormType.php index 0601d7e4f..548c8f638 100644 --- a/app/src/Talk/SpeakerFormType.php +++ b/app/src/Talk/SpeakerFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\Talk; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -31,7 +32,7 @@ public function getName() public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('name', 'text', [ + ->add('name', TextType::class, [ 'label' => false, 'required' => false, ]); diff --git a/app/src/Talk/TalkDeleteFormType.php b/app/src/Talk/TalkDeleteFormType.php index 8ab48aeba..6f6cf9044 100644 --- a/app/src/Talk/TalkDeleteFormType.php +++ b/app/src/Talk/TalkDeleteFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\Talk; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -34,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'talk_uri', - 'hidden', + HiddenType::class, [] ) ; diff --git a/app/src/Talk/TalkFormType.php b/app/src/Talk/TalkFormType.php index 4429c8747..62e361fc7 100644 --- a/app/src/Talk/TalkFormType.php +++ b/app/src/Talk/TalkFormType.php @@ -5,6 +5,12 @@ use DateTimeImmutable; use JoindIn\Web\Event\EventEntity; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\DateTimeType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -78,14 +84,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'talk_title', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank()], ] ) ->add( 'talk_description', - 'textarea', + TextareaType::class, [ 'constraints' => [new Assert\NotBlank()], 'attr' => ['rows' => '10'] @@ -93,7 +99,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'start_date', - 'datetime', + DateTimeType::class, [ 'label' => 'Date and time of talk', 'date_widget' => 'single_text', @@ -128,7 +134,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'duration', - 'integer', + IntegerType::class, [ 'label' => 'Duration (mins)', 'precision' => 0, @@ -144,21 +150,21 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'language', - 'choice', + ChoiceType::class, [ 'choices' => ['' => ''] + $this->languages ] ) ->add( 'type', - 'choice', + ChoiceType::class, [ 'choices' => ['' => ''] + $this->talkTypes ] ) ->add( 'track', - 'choice', + ChoiceType::class, [ 'required' => (bool) ! empty($this->tracks), 'choices' => ['' => ''] + $this->tracks @@ -166,7 +172,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'speakers', - 'collection', + CollectionType::class, [ 'label' => 'Speakers!', 'type' => new SpeakerFormType(), @@ -176,7 +182,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'talk_media', - 'collection', + CollectionType::class, [ 'label' => 'Talk Media', 'type' => new TalkMediaFormType(), diff --git a/app/src/Talk/TalkMediaFormType.php b/app/src/Talk/TalkMediaFormType.php index fd5fb2291..8cb111f86 100644 --- a/app/src/Talk/TalkMediaFormType.php +++ b/app/src/Talk/TalkMediaFormType.php @@ -3,6 +3,8 @@ namespace JoindIn\Web\Talk; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -33,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'type', - 'choice', + ChoiceType::class, [ 'choices' => [ 'slides_link' => 'Slides', @@ -45,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => false, ] ) - ->add('url', 'text', [ + ->add('url', TextType::class, [ 'label' => false, 'required' => false, ]) diff --git a/app/src/User/EmailInputFormType.php b/app/src/User/EmailInputFormType.php index 335598e67..20c417130 100644 --- a/app/src/User/EmailInputFormType.php +++ b/app/src/User/EmailInputFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\User; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -37,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'email', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], diff --git a/app/src/User/NewPasswordFormType.php b/app/src/User/NewPasswordFormType.php index 12b9048ee..f18bcb4f8 100644 --- a/app/src/User/NewPasswordFormType.php +++ b/app/src/User/NewPasswordFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\User; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -37,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'password', - 'repeated', + RepeatedType::class, [ 'type' => 'password', 'invalid_message' => 'The password fields must match.', diff --git a/app/src/User/RegisterFormType.php b/app/src/User/RegisterFormType.php index 3753ff657..4f5566ff7 100644 --- a/app/src/User/RegisterFormType.php +++ b/app/src/User/RegisterFormType.php @@ -3,6 +3,9 @@ namespace JoindIn\Web\User; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\RepeatedType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -37,14 +40,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'username', - 'text', + TextType::class, [ 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 100])], ] ) ->add( 'password', - 'repeated', + RepeatedType::class, [ 'type' => 'password', 'invalid_message' => 'The password fields must match.', @@ -56,7 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'email', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], @@ -64,7 +67,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'full_name', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Length(['max' => 200])], @@ -72,14 +75,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'twitter_username', - 'text', + TextType::class, [ 'required' => false ] ) ->add( 'biography', - 'textarea', + TextareaType::class, [ 'required' => false, 'empty_data' => '', diff --git a/app/src/User/UserFormType.php b/app/src/User/UserFormType.php index a75cd7249..b0f8a4ce6 100644 --- a/app/src/User/UserFormType.php +++ b/app/src/User/UserFormType.php @@ -3,6 +3,10 @@ namespace JoindIn\Web\User; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\PasswordType; +use Symfony\Component\Form\Extension\Core\Type\RepeatedType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -44,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'full_name', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank()], @@ -52,7 +56,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'email', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Email()], @@ -60,7 +64,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'twitter_username', - 'text', + TextType::class, [ 'required' => false, 'empty_data' => '', @@ -69,7 +73,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'biography', - 'textarea', + TextareaType::class, [ 'required' => false, 'empty_data' => '', @@ -84,7 +88,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'old_password', - 'password', + PasswordType::class, [ 'label' => 'Current password', 'required' => false, @@ -93,7 +97,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'password', - 'repeated', + RepeatedType::class, [ 'type' => 'password', 'invalid_message' => 'The password fields must match.', diff --git a/app/src/User/UsernameInputFormType.php b/app/src/User/UsernameInputFormType.php index a23df1539..98865d721 100644 --- a/app/src/User/UsernameInputFormType.php +++ b/app/src/User/UsernameInputFormType.php @@ -3,6 +3,7 @@ namespace JoindIn\Web\User; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -37,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add( 'username', - 'text', + TextType::class, [ 'required' => true, 'constraints' => [new Assert\NotBlank()], From 9ba883397604383fe086528730386d500b5c8ba0 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 14:50:05 +0200 Subject: [PATCH 51/56] fix test --- tests/Event/EventFormTypeTest.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/Event/EventFormTypeTest.php b/tests/Event/EventFormTypeTest.php index dbe1e737b..a71764c92 100644 --- a/tests/Event/EventFormTypeTest.php +++ b/tests/Event/EventFormTypeTest.php @@ -2,7 +2,6 @@ namespace JoindIn\Web\Tests\Event; -use JoindIn\Web\Event\EventEntity; use JoindIn\Web\Event\EventFormType; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; use Symfony\Component\Form\Form; @@ -32,7 +31,7 @@ protected function getExtensions() public function testSubmitValidData() { - $formData = [ + $formResultData = [ "name" => "Community Conference", "description" => "Conference description.", "tags" => ["php", "conference", "web"], @@ -50,18 +49,36 @@ public function testSubmitValidData() "new_icon" => null ]; + $submittedFormData = [ + "name" => "Community Conference", + "description" => "Conference description.", + "tags" => "php, conference, web", + "tz_continent" => "Europe", + "tz_place" => "Amsterdam", + "start_date" => "2019-01-01", + "end_date" => "2019-01-02", + "href" => "https://example.com/2019", + "cfp_start_date" => "2019-01-03", + "cfp_end_date" => "2019-01-01", + "cfp_url" => "https://example.com/cfp", + "location" => "Location", + "latitude" => "52.3546273", + "longitude" => "4.8284121", + "new_icon" => null + ]; + $form = $this->factory->create(EventFormType::class); - $form->submit($formData); + $form->submit($submittedFormData); $this->assertTrue($form->isSynchronized()); - $this->assertEquals($formData, $form->getData()); + $this->assertEquals($formResultData, $form->getData()); $view = $form->createView(); $children = $view->children; - foreach (array_keys($formData) as $key) { + foreach (array_keys($formResultData) as $key) { $this->assertArrayHasKey($key, $children); } } From de276426e86a878911cfe6008f593d245bcd8058 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 14:51:41 +0200 Subject: [PATCH 52/56] fix loading of translation with symfony 3.4 --- app/src/Middleware/ValidationMiddleware.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/Middleware/ValidationMiddleware.php b/app/src/Middleware/ValidationMiddleware.php index bf70032b9..02d2d57d5 100644 --- a/app/src/Middleware/ValidationMiddleware.php +++ b/app/src/Middleware/ValidationMiddleware.php @@ -11,7 +11,7 @@ use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\ValidatorInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; /** * In this middleware we create the validation services as provided by Symfony and register it as service in the @@ -128,7 +128,7 @@ private function getTranslator() */ private function getTranslationsRootFolder() { - $r = new \ReflectionClass('Symfony\Component\Validator\Validator'); + $r = new \ReflectionClass(ValidatorInterface::class); return dirname($r->getFilename()); } From 1a6af6b352c734a8d44342b58d56d26dc081508d Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 14:58:24 +0200 Subject: [PATCH 53/56] fix symfony deprecations --- app/src/Middleware/FormMiddleware.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 77e2d2991..9d7e3bc44 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -5,12 +5,13 @@ use Slim\Middleware; use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; +use Symfony\Component\Form\Form; use Symfony\Component\Form\FormFactoryBuilder; use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\FormRenderer; use Symfony\Component\Form\Forms; use Symfony\Component\Form\ResolvedFormTypeFactory; use Symfony\Component\Security\Csrf\CsrfTokenManager; @@ -20,6 +21,8 @@ use Symfony\Component\Translation\Loader\XliffFileLoader; use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\Translator; +use Twig\Loader\ChainLoader; +use Twig\Loader\FilesystemLoader; /** * Middleware for Slim used to integrate Symfony forms into Slim. @@ -70,6 +73,7 @@ public function __construct($csrfSecret = null, $locale = 'en_UK') * ``` * * @return void + * @throws \ReflectionException */ public function call() { @@ -100,9 +104,10 @@ function () use ($formMiddleWare, $csrfSecret) { * Generally this method does not need to be called directly; it is used in a callback that created a shared * instance in the container of Slim. * + * @return FormFactoryInterface + * @throws \ReflectionException * @see self::call() where this method is used to construct a shared instance in Slim. * - * @return FormFactoryInterface */ public function createFormFactory() { @@ -138,8 +143,8 @@ public function createFormFactory() private function getChainingLoader($env) { $loader = $env->getLoader(); - if (!$loader instanceof \Twig_Loader_Chain) { - $loader = new \Twig_Loader_Chain([$loader]); + if (!$loader instanceof ChainLoader) { + $loader = new ChainLoader([$loader]); $env->setLoader($loader); } @@ -149,15 +154,16 @@ private function getChainingLoader($env) /** * Adds a loader to Twig pointing to the location of the default templates for forms. * - * @param \Twig_Loader_Chain $loader + * @param ChainLoader $loader * * @return void + * @throws \ReflectionException */ - private function addFormTemplatesFolderToLoader(\Twig_Loader_Chain $loader) + private function addFormTemplatesFolderToLoader(ChainLoader $loader) { - $reflected = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); + $reflected = new \ReflectionClass(FormExtension::class); $path = dirname($reflected->getFileName()) . '/../Resources/views/Form'; - $loader->addLoader(new \Twig_Loader_Filesystem($path)); + $loader->addLoader(new FilesystemLoader($path)); } /** @@ -169,7 +175,7 @@ private function addFormTemplatesFolderToLoader(\Twig_Loader_Chain $loader) */ private function createFormTwigExtension($formLayoutTemplate) { - return new FormExtension(new TwigRenderer(new TwigRendererEngine([$formLayoutTemplate]))); + return new FormExtension(new FormRenderer(new TwigRendererEngine([$formLayoutTemplate]))); } /** @@ -200,13 +206,14 @@ private function getTwigEnvironment() * @param FormFactoryBuilder $builder * * @return void + * @throws \ReflectionException */ protected function addValidatorExtensionToFactoryBuilder(FormFactoryBuilder $builder) { $builder->addExtension(new ValidatorExtension($this->app->validator)); if (isset($this->app->translator)) { - $r = new \ReflectionClass('Symfony\Component\Form\Form'); + $r = new \ReflectionClass(Form::class); $this->app->translator->addResource( 'xliff', dirname($r->getFilename()) . '/Resources/translations/validators.' . $this->locale . '.xlf', From 94f096cac3e262bded2808b241453feb5a418b22 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 14:59:31 +0200 Subject: [PATCH 54/56] bump symfony components to 3.4 --- composer.json | 36 ++- composer.lock | 855 +++++++++++++++++++++++++++++++------------------- 2 files changed, 554 insertions(+), 337 deletions(-) diff --git a/composer.json b/composer.json index 243f093f4..c064dfb50 100644 --- a/composer.json +++ b/composer.json @@ -19,25 +19,33 @@ }, "minimum-stability": "stable", "require": { - "guzzlehttp/guzzle": "^6.2.1", - "monolog/monolog": "^1.21", - "org_heigl/daterange": "~1.1", - "predis/predis": "~0.8", - "slim/slim": "~2.4", - "slim/views": "~0.1", - "symfony/form": "~2.8", - "symfony/validator": "~2.8", - "symfony/security-csrf": "~2.8", - "symfony/twig-bridge": "~2.8", - "twig/twig": "~1.15", - "ext-json": "*" + "ext-json": "*", + "guzzlehttp/guzzle": "^6.2.1", + "monolog/monolog": "^1.21", + "org_heigl/daterange": "~1.1", + "predis/predis": "~0.8", + "slim/slim": "~2.4", + "slim/views": "~0.1", + "symfony/console": "^3.4", + "symfony/form": "^3.4", + "symfony/inflector": "^3.4", + "symfony/intl": "^3.4", + "symfony/options-resolver": "^3.4", + "symfony/property-access": "^3.4", + "symfony/security-core": "^3.4", + "symfony/security-csrf": "^3.4", + "symfony/translation": "^3.4", + "symfony/twig-bridge": "^3.4", + "symfony/validator": "^3.4", + "twig/twig": "~1.15" }, "require-dev": { "jakub-onderka/php-parallel-lint": "^1.0", - "phpunit/phpunit": "^7.0", + "phpunit/phpunit": "^8.0", "roave/security-advisories": "dev-master", "sensiolabs/security-checker": "^5.0", - "squizlabs/php_codesniffer": "^3.4" + "squizlabs/php_codesniffer": "^3.4", + "symfony/debug": "^3.4" }, "scripts": { "test": "phpunit -c . tests/", diff --git a/composer.lock b/composer.lock index c41aebe56..f378e2552 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4f61645952b4ada8ee063803020d2117", + "content-hash": "9791671e0682c8ff0fc89bb302247df6", "packages": [ { "name": "guzzlehttp/guzzle", @@ -651,29 +651,246 @@ ], "time": "2014-12-09T23:48:51+00:00" }, + { + "name": "symfony/console", + "version": "v3.4.28", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6", + "reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2019-05-09T08:42:51+00:00" + }, + { + "name": "symfony/contracts", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/contracts.git", + "reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/contracts/zipball/2d19b12caccbd80cf0c85624dc87b7021a0df1d5", + "reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "replace": { + "symfony/cache-contracts": "self.version", + "symfony/event-dispatcher-contracts": "self.version", + "symfony/http-client-contracts": "self.version", + "symfony/service-contracts": "self.version", + "symfony/translation-contracts": "self.version" + }, + "require-dev": { + "psr/cache": "^1.0", + "psr/container": "^1.0", + "symfony/polyfill-intl-idn": "^1.10" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "psr/event-dispatcher": "When using the EventDispatcher contracts", + "symfony/cache-implementation": "", + "symfony/event-dispatcher-implementation": "", + "symfony/http-client-implementation": "", + "symfony/service-implementation": "", + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\": "" + }, + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A set of abstractions extracted out of the Symfony components", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-06-05T13:28:50+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.28", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "671fc55bd14800668b1d0a3708c3714940e30a8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/671fc55bd14800668b1d0a3708c3714940e30a8c", + "reference": "671fc55bd14800668b1d0a3708c3714940e30a8c", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2019-05-18T13:32:47+00:00" + }, { "name": "symfony/event-dispatcher", - "version": "v3.0.9", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "54da3ff63dec3c9c0e32ec3f95a7d94ef64baa00" + "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54da3ff63dec3c9c0e32ec3f95a7d94ef64baa00", - "reference": "54da3ff63dec3c9c0e32ec3f95a7d94ef64baa00", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4e6c670af81c4fb0b6c08b035530a9915d0b691f", + "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.1.3", + "symfony/event-dispatcher-contracts": "^1.1" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "1.1" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "^3.4|^4.0", + "symfony/service-contracts": "^1.1", + "symfony/stopwatch": "~3.4|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -682,7 +899,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -709,45 +926,50 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-07-19T10:44:15+00:00" + "time": "2019-05-30T16:10:05+00:00" }, { "name": "symfony/form", - "version": "v2.8.50", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "74382a47aa97496d181fbb598822fdfb9e1744e4" + "reference": "ce56406a0ac22a5b199236253c39f3b080b93d0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/74382a47aa97496d181fbb598822fdfb9e1744e4", - "reference": "74382a47aa97496d181fbb598822fdfb9e1744e4", + "url": "https://api.github.com/repos/symfony/form/zipball/ce56406a0ac22a5b199236253c39f3b080b93d0e", + "reference": "ce56406a0ac22a5b199236253c39f3b080b93d0e", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", - "symfony/options-resolver": "~2.6", + "php": "^5.5.9|>=7.0.8", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/options-resolver": "~3.4|~4.0", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/property-access": "~2.3|~3.0.0" + "symfony/property-access": "~2.8|~3.0|~4.0" }, "conflict": { "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/dependency-injection": "<3.3", "symfony/doctrine-bridge": "<2.7", - "symfony/framework-bundle": "<2.7", - "symfony/twig-bridge": "<2.7" + "symfony/framework-bundle": "<3.4", + "symfony/http-kernel": "<3.3.5", + "symfony/twig-bridge": "<3.4.5|<4.0.5,>=4.0" }, "require-dev": { "doctrine/collections": "~1.0", - "symfony/dependency-injection": "~2.7|~3.0.0", - "symfony/http-foundation": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.4|~3.0.0", - "symfony/security-csrf": "^2.8.31|^3.3.13", - "symfony/translation": "^2.0.5|~3.0.0", - "symfony/validator": "^2.8.18|~3.2.5" + "symfony/config": "~2.7|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/http-kernel": "^3.3.5|~4.0", + "symfony/security-csrf": "^2.8.31|^3.3.13|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/validator": "^3.2.5|~4.0", + "symfony/var-dumper": "~3.3.11|~3.4|~4.0" }, "suggest": { "symfony/framework-bundle": "For templating with PHP.", @@ -758,7 +980,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -785,28 +1007,86 @@ ], "description": "Symfony Form Component", "homepage": "https://symfony.com", - "time": "2018-12-06T11:12:46+00:00" + "time": "2019-05-14T14:13:30+00:00" + }, + { + "name": "symfony/inflector", + "version": "v3.4.28", + "source": { + "type": "git", + "url": "https://github.com/symfony/inflector.git", + "reference": "4a7d5c4ad3edeba3fe4a27d26ece6a012eee46b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/inflector/zipball/4a7d5c4ad3edeba3fe4a27d26ece6a012eee46b1", + "reference": "4a7d5c4ad3edeba3fe4a27d26ece6a012eee46b1", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Inflector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Inflector Component", + "homepage": "https://symfony.com", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string", + "symfony", + "words" + ], + "time": "2019-01-16T13:27:11+00:00" }, { "name": "symfony/intl", - "version": "v3.2.14", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "3fd98dde8e7d1c34c974d65b09e9c32abe88dafe" + "reference": "3217e574d10034bd27f8bcd4f02d6e4c34edfc42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/3fd98dde8e7d1c34c974d65b09e9c32abe88dafe", - "reference": "3fd98dde8e7d1c34c974d65b09e9c32abe88dafe", + "url": "https://api.github.com/repos/symfony/intl/zipball/3217e574d10034bd27f8bcd4f02d6e4c34edfc42", + "reference": "3217e574d10034bd27f8bcd4f02d6e4c34edfc42", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-intl-icu": "~1.0" }, "require-dev": { - "symfony/filesystem": "~2.8|~3.0" + "symfony/filesystem": "~2.8|~3.0|~4.0" }, "suggest": { "ext-intl": "to use the component with locales other than \"en\"" @@ -814,7 +1094,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -860,29 +1140,29 @@ "l10n", "localization" ], - "time": "2017-11-16T17:55:54+00:00" + "time": "2019-05-09T08:31:33+00:00" }, { "name": "symfony/options-resolver", - "version": "v2.8.50", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b" + "reference": "ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/7aaab725bb58f0e18aa12c61bdadd4793ab4c32b", - "reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44", + "reference": "ed3b397f9c07c8ca388b2a1ef744403b4d4ecc44", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -914,7 +1194,7 @@ "configuration", "options" ], - "time": "2018-11-11T11:18:13+00:00" + "time": "2019-04-10T16:00:48+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1260,25 +1540,33 @@ }, { "name": "symfony/property-access", - "version": "v3.0.9", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "a4f1a668d0a269a65790f07d9ab2a97dd060fccb" + "reference": "9b1c9df96a00c14445bef4cf37ad85e7239d8a4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/a4f1a668d0a269a65790f07d9ab2a97dd060fccb", - "reference": "a4f1a668d0a269a65790f07d9ab2a97dd060fccb", + "url": "https://api.github.com/repos/symfony/property-access/zipball/9b1c9df96a00c14445bef4cf37ad85e7239d8a4a", + "reference": "9b1c9df96a00c14445bef4cf37ad85e7239d8a4a", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8", + "symfony/inflector": "~3.1|~4.0", + "symfony/polyfill-php70": "~1.0" + }, + "require-dev": { + "symfony/cache": "~3.1|~4.0" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1316,7 +1604,7 @@ "property path", "reflection" ], - "time": "2016-07-30T07:22:48+00:00" + "time": "2019-03-04T06:36:31+00:00" }, { "name": "symfony/security-core", @@ -1387,29 +1675,29 @@ }, { "name": "symfony/security-csrf", - "version": "v2.8.50", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "91957524d5e01416a2e6ece04667f2060f717a76" + "reference": "76ae1a389baca0375dd0a21c1f33fae901ad6cb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/91957524d5e01416a2e6ece04667f2060f717a76", - "reference": "91957524d5e01416a2e6ece04667f2060f717a76", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/76ae1a389baca0375dd0a21c1f33fae901ad6cb0", + "reference": "76ae1a389baca0375dd0a21c1f33fae901ad6cb0", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-php56": "~1.0", "symfony/polyfill-php70": "~1.0", - "symfony/security-core": "^2.8.41|^3.3.17" + "symfony/security-core": "~2.8|~3.0|~4.0" }, "conflict": { - "symfony/http-foundation": "<2.7.38|~2.8,<2.8.31|~3.3,<3.3.13" + "symfony/http-foundation": "<2.8.31|~3.3,<3.3.13" }, "require-dev": { - "symfony/http-foundation": "^2.7.38|~3.3.13" + "symfony/http-foundation": "^2.8.31|~3.3.13|~3.4|~4.0" }, "suggest": { "symfony/http-foundation": "For using the class SessionTokenStorage." @@ -1417,7 +1705,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1444,44 +1732,50 @@ ], "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", - "time": "2018-11-11T11:18:13+00:00" + "time": "2019-01-16T09:39:14+00:00" }, { "name": "symfony/translation", - "version": "v3.0.9", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26" + "reference": "301a5d627220a1c4ee522813b0028653af6c4f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/eee6c664853fd0576f21ae25725cfffeafe83f26", - "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26", + "url": "https://api.github.com/repos/symfony/translation/zipball/301a5d627220a1c4ee522813b0028653af6c4f54", + "reference": "301a5d627220a1c4ee522813b0028653af6c4f54", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/config": "<2.8" + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/http-kernel": "~3.4|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/var-dumper": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { - "psr/log": "To use logging capability in translator", + "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1508,46 +1802,50 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-07-30T07:22:48+00:00" + "time": "2019-05-01T11:10:09+00:00" }, { "name": "symfony/twig-bridge", - "version": "v2.8.50", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "ecc1e30d05fa99f25b504e2d6a8684555ae39f7c" + "reference": "9fc026c05e927fe59cf89f67b9f9926e44301eea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/ecc1e30d05fa99f25b504e2d6a8684555ae39f7c", - "reference": "ecc1e30d05fa99f25b504e2d6a8684555ae39f7c", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/9fc026c05e927fe59cf89f67b9f9926e44301eea", + "reference": "9fc026c05e927fe59cf89f67b9f9926e44301eea", "shasum": "" }, "require": { - "php": ">=5.3.9", - "twig/twig": "~1.34|~2.4" + "php": "^5.5.9|>=7.0.8", + "twig/twig": "^1.40|^2.9" }, "conflict": { - "symfony/form": "<2.8.23" + "symfony/console": "<3.4", + "symfony/form": "<3.4.13|>=4.0,<4.0.13|>=4.1,<4.1.2" }, "require-dev": { - "symfony/asset": "~2.7|~3.0.0", - "symfony/console": "~2.8|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/finder": "~2.3|~3.0.0", - "symfony/form": "^2.8.23", - "symfony/http-foundation": "^2.8.29|~3.0.0", - "symfony/http-kernel": "~2.8|~3.0.0", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "^3.4.23|^4.2.4", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/security": "^2.8.31|^3.3.13", - "symfony/security-acl": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.2|~3.0.0", - "symfony/templating": "~2.1|~3.0.0", - "symfony/translation": "~2.7|~3.0.0", - "symfony/var-dumper": "~2.7.16|~2.8.9|~3.0.9", - "symfony/yaml": "^2.0.5|~3.0.0" + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/security": "^2.8.31|^3.3.13|~4.0", + "symfony/security-acl": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/asset": "For using the AssetExtension", @@ -1561,12 +1859,13 @@ "symfony/templating": "For using the TwigEngine", "symfony/translation": "For using the TranslationExtension", "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", "symfony/yaml": "For using the YamlExtension" }, "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1593,54 +1892,65 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2018-11-11T11:18:13+00:00" + "time": "2019-04-30T12:26:26+00:00" }, { "name": "symfony/validator", - "version": "v2.8.50", + "version": "v3.4.28", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "d5d2090bba3139d8ddb79959fbf516e87238fe3a" + "reference": "23cf394faaffb6257f5764fbfc2db12ec30956f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/d5d2090bba3139d8ddb79959fbf516e87238fe3a", - "reference": "d5d2090bba3139d8ddb79959fbf516e87238fe3a", + "url": "https://api.github.com/repos/symfony/validator/zipball/23cf394faaffb6257f5764fbfc2db12ec30956f1", + "reference": "23cf394faaffb6257f5764fbfc2db12ec30956f1", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation": "~2.4|~3.0.0" + "symfony/translation": "~2.8|~3.0|~4.0" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/dependency-injection": "<3.3", + "symfony/http-kernel": "<3.3.5", + "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", - "egulias/email-validator": "^1.2.1", - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/http-foundation": "~2.3|~3.0.0", - "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", - "symfony/property-access": "~2.3|~3.0.0", - "symfony/yaml": "^2.0.5|~3.0.0" + "egulias/email-validator": "^1.2.8|~2.0", + "symfony/cache": "~3.1|~4.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/http-kernel": "^3.3.5|~4.0", + "symfony/intl": "^2.8.18|^3.2.5|~4.0", + "symfony/property-access": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", "doctrine/cache": "For using the default cached annotation reader and metadata cache.", "egulias/email-validator": "Strict (RFC compliant) email validation", + "psr/cache-implementation": "For using the metadata cache.", "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", + "symfony/expression-language": "For using the Expression validator", "symfony/http-foundation": "", "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", + "symfony/property-access": "For accessing properties within comparison constraints", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1667,20 +1977,20 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2018-11-14T14:06:48+00:00" + "time": "2019-05-05T16:11:06+00:00" }, { "name": "twig/twig", - "version": "v1.42.0", + "version": "v1.42.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "2983fcf2e20a4afe95f07e61d89a7590b3c8df2e" + "reference": "671347603760a88b1e7288aaa9378f33687d7edf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/2983fcf2e20a4afe95f07e61d89a7590b3c8df2e", - "reference": "2983fcf2e20a4afe95f07e61d89a7590b3c8df2e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/671347603760a88b1e7288aaa9378f33687d7edf", + "reference": "671347603760a88b1e7288aaa9378f33687d7edf", "shasum": "" }, "require": { @@ -1733,7 +2043,7 @@ "keywords": [ "templating" ], - "time": "2019-05-31T06:20:05+00:00" + "time": "2019-06-04T11:31:08+00:00" } ], "packages-dev": [ @@ -2264,40 +2574,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "aed67b57d459dcab93e84a5c9703d3deb5025dff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aed67b57d459dcab93e84a5c9703d3deb5025dff", + "reference": "aed67b57d459dcab93e84a5c9703d3deb5025dff", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.1", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.0" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -2323,7 +2633,7 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "time": "2019-06-06T12:28:18+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2418,16 +2728,16 @@ }, { "name": "phpunit/php-timer", - "version": "2.1.1", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059", - "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { @@ -2463,7 +2773,7 @@ "keywords": [ "timer" ], - "time": "2019-02-20T10:12:59+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", @@ -2516,53 +2826,52 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.12", + "version": "8.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c" + "reference": "047f771e34dccacb6c432a1a70e9980e087eac92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c", - "reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/047f771e34dccacb6c432a1a70e9980e087eac92", + "reference": "047f771e34dccacb6c432a1a70e9980e087eac92", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.0", + "phpunit/php-code-coverage": "^7.0.5", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.0", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.0", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -2570,7 +2879,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.2-dev" } }, "autoload": { @@ -2596,7 +2905,7 @@ "testing", "xunit" ], - "time": "2019-05-28T11:59:40+00:00" + "time": "2019-06-07T14:04:13+00:00" }, { "name": "roave/security-advisories", @@ -3096,23 +3405,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -3120,7 +3432,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3143,7 +3455,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -3332,6 +3644,52 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "time": "2018-10-04T04:07:39+00:00" }, + { + "name": "sebastian/type", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "b2a7f9aac51ce18cd7ac8b31e37c8ce5646fc741" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b2a7f9aac51ce18cd7ac8b31e37c8ce5646fc741", + "reference": "b2a7f9aac51ce18cd7ac8b31e37c8ce5646fc741", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-06-08T04:53:27+00:00" + }, { "name": "sebastian/version", "version": "2.0.1", @@ -3472,157 +3830,6 @@ ], "time": "2019-04-10T23:49:02+00:00" }, - { - "name": "symfony/console", - "version": "v4.2.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "7a293c9a4587a92e6a0e81edb0bea54071b1b99d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/7a293c9a4587a92e6a0e81edb0bea54071b1b99d", - "reference": "7a293c9a4587a92e6a0e81edb0bea54071b1b99d", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/contracts": "^1.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2019-05-09T09:19:46+00:00" - }, - { - "name": "symfony/contracts", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/contracts.git", - "reference": "b6e291a08e6b002fb56aa6f3e2a2beb6674d2b2f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/contracts/zipball/b6e291a08e6b002fb56aa6f3e2a2beb6674d2b2f", - "reference": "b6e291a08e6b002fb56aa6f3e2a2beb6674d2b2f", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "replace": { - "symfony/cache-contracts": "self.version", - "symfony/event-dispatcher-contracts": "self.version", - "symfony/http-client-contracts": "self.version", - "symfony/service-contracts": "self.version", - "symfony/translation-contracts": "self.version" - }, - "require-dev": { - "psr/cache": "^1.0", - "psr/container": "^1.0", - "symfony/polyfill-intl-idn": "^1.10" - }, - "suggest": { - "psr/cache": "When using the Cache contracts", - "psr/container": "When using the Service contracts", - "psr/event-dispatcher": "When using the EventDispatcher contracts", - "symfony/cache-implementation": "", - "symfony/event-dispatcher-implementation": "", - "symfony/http-client-implementation": "", - "symfony/service-implementation": "", - "symfony/translation-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\": "" - }, - "exclude-from-classmap": [ - "**/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A set of abstractions extracted out of the Symfony components", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-05-28T07:50:59+00:00" - }, { "name": "theseer/tokenizer", "version": "1.1.2", @@ -3722,7 +3929,9 @@ }, "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "ext-json": "*" + }, "platform-dev": [], "platform-overrides": { "php": "7.3.2" From a0ba0cb4be427b968b675faa399f5aced704e466 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 15:20:22 +0200 Subject: [PATCH 55/56] fix indentation --- app/src/User/UserFormType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/User/UserFormType.php b/app/src/User/UserFormType.php index b0f8a4ce6..8857fba36 100644 --- a/app/src/User/UserFormType.php +++ b/app/src/User/UserFormType.php @@ -73,7 +73,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ) ->add( 'biography', - TextareaType::class, + TextareaType::class, [ 'required' => false, 'empty_data' => '', From a4596acfc99cb0811bc0454732c8f5b3162ab0e1 Mon Sep 17 00:00:00 2001 From: Jos Elstgeest Date: Sun, 9 Jun 2019 15:34:16 +0200 Subject: [PATCH 56/56] revert replacing twigrenderer with formrenderer --- app/src/Middleware/FormMiddleware.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/Middleware/FormMiddleware.php b/app/src/Middleware/FormMiddleware.php index 9d7e3bc44..0753c2dea 100644 --- a/app/src/Middleware/FormMiddleware.php +++ b/app/src/Middleware/FormMiddleware.php @@ -5,6 +5,7 @@ use Slim\Middleware; use Symfony\Bridge\Twig\Extension\FormExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension; +use Symfony\Bridge\Twig\Form\TwigRenderer; use Symfony\Bridge\Twig\Form\TwigRendererEngine; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; @@ -175,7 +176,7 @@ private function addFormTemplatesFolderToLoader(ChainLoader $loader) */ private function createFormTwigExtension($formLayoutTemplate) { - return new FormExtension(new FormRenderer(new TwigRendererEngine([$formLayoutTemplate]))); + return new FormExtension(new TwigRenderer(new TwigRendererEngine([$formLayoutTemplate]))); } /**