@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Meetup; |
4 | 4 | |
5 | 5 | use GuzzleHttp\Client; |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | public function getMeetupAttendees($eventUrl) |
35 | 35 | { |
36 | 36 | if (strpos($eventUrl, 'meetup.com') === false) { |
37 | - return []; |
|
37 | + return [ ]; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | try { |
41 | 41 | $parts = explode('/', $eventUrl); |
42 | - $meetupId = $parts[count($parts) - 2]; |
|
42 | + $meetupId = $parts[ count($parts) - 2 ]; |
|
43 | 43 | $uri = sprintf(self::API_URL, $meetupId, $this->key); |
44 | 44 | $request = new Request('GET', $uri); |
45 | 45 | $response = $this->httpClient->send($request); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | return $attendees; |
51 | 51 | } catch (\Exception $e) { |
52 | - return []; |
|
52 | + return [ ]; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Meetup; |
4 | 4 | |
5 | 5 | use Interop\Container\ContainerInterface; |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function __invoke(ContainerInterface $container): MeetupApiService |
16 | 16 | { |
17 | - $config = $container->get('config')['meetupApi']; |
|
17 | + $config = $container->get('config')[ 'meetupApi' ]; |
|
18 | 18 | |
19 | - return new MeetupApiService($config['key']); |
|
19 | + return new MeetupApiService($config[ 'key' ]); |
|
20 | 20 | } |
21 | 21 | } |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | public function index(): \Psr\Http\Message\ResponseInterface |
53 | 53 | { |
54 | 54 | $params = $this->request->getQueryParams(); |
55 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
56 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
55 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
56 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
57 | 57 | |
58 | 58 | $categories = $this->categoryService->getPagination($page, $limit); |
59 | 59 | |
60 | 60 | return new HtmlResponse($this->template->render( |
61 | 61 | 'category::index/index', |
62 | - ['list' => $categories, 'layout' => 'layout/admin']) |
|
62 | + [ 'list' => $categories, 'layout' => 'layout/admin' ]) |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return \Psr\Http\Message\ResponseInterface |
70 | 70 | */ |
71 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
71 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
72 | 72 | { |
73 | 73 | $id = $this->request->getAttribute('id'); |
74 | 74 | $category = $this->categoryService->getCategory($id); |
75 | 75 | |
76 | 76 | if ($this->request->getParsedBody()) { |
77 | - $category = (object)($this->request->getParsedBody() + (array)$category); |
|
77 | + $category = (object) ($this->request->getParsedBody() + (array) $category); |
|
78 | 78 | $category->category_id = $id; |
79 | 79 | } |
80 | 80 |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | [ |
20 | 20 | 'name' => 'name', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim']], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'slug', |
33 | 33 | 'required' => true, |
34 | - 'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]], |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ], |
|
35 | 35 | 'validators' => [ |
36 | - ['name' => 'NotEmpty'], |
|
37 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
36 | + [ 'name' => 'NotEmpty' ], |
|
37 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
38 | 38 | ], |
39 | 39 | ] |
40 | 40 | ); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | [ |
44 | 44 | 'name' => 'title', |
45 | 45 | 'required' => false, |
46 | - 'filters' => [['name' => 'StringTrim']], |
|
46 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
47 | 47 | 'validators' => [ |
48 | - ['name' => 'NotEmpty'], |
|
49 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
48 | + [ 'name' => 'NotEmpty' ], |
|
49 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
50 | 50 | ], |
51 | 51 | ] |
52 | 52 | ); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | [ |
56 | 56 | 'name' => 'description', |
57 | 57 | 'required' => false, |
58 | - 'filters' => [['name' => 'StringTrim']], |
|
58 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
59 | 59 | 'validators' => [ |
60 | - ['name' => 'NotEmpty'], |
|
61 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1000]], |
|
60 | + [ 'name' => 'NotEmpty' ], |
|
61 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1000 ] ], |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | [ |
68 | 68 | 'name' => 'is_in_homepage', |
69 | 69 | 'required' => false, |
70 | - 'filters' => [['name' => 'Boolean']], |
|
70 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
71 | 71 | ] |
72 | 72 | ); |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | [ |
76 | 76 | 'name' => 'is_in_category_list', |
77 | 77 | 'required' => false, |
78 | - 'filters' => [['name' => 'Boolean']], |
|
78 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
79 | 79 | ] |
80 | 80 | ); |
81 | 81 |
@@ -11,11 +11,11 @@ |
||
11 | 11 | $categoryMapper = $this->getMockBuilder(\Category\Mapper\CategoryMapper::class) |
12 | 12 | ->getMockForAbstractClass(); |
13 | 13 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
14 | - ->setMethods(['get']) |
|
14 | + ->setMethods([ 'get' ]) |
|
15 | 15 | ->getMockForAbstractClass(); |
16 | 16 | $container->expects(static::at(0)) |
17 | 17 | ->method('get') |
18 | - ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']])); |
|
18 | + ->will(static::returnValue([ 'upload' => [ 'public_path' => 'test', 'non_public_path' => 'test' ] ])); |
|
19 | 19 | $container->expects(static::at(1)) |
20 | 20 | ->method('get') |
21 | 21 | ->will(static::returnValue($categoryMapper)); |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | public $admin_user_id = '123'; |
14 | 14 | }; |
15 | 15 | $bcrypt = $this->getMockBuilder(\Zend\Crypt\Password\Bcrypt::class) |
16 | - ->setMethods(['verify']) |
|
16 | + ->setMethods([ 'verify' ]) |
|
17 | 17 | ->getMock(); |
18 | 18 | $bcrypt->expects(static::once()) |
19 | 19 | ->method('verify') |
20 | 20 | ->will(static::returnValue(true)); |
21 | 21 | $adminUsersMapper = $this->getMockBuilder(\Admin\Mapper\AdminUsersMapper::class) |
22 | - ->setMethods(['getByEmail', 'updateLogin']) |
|
22 | + ->setMethods([ 'getByEmail', 'updateLogin' ]) |
|
23 | 23 | ->getMock(); |
24 | 24 | $adminUsersMapper->expects(static::once()) |
25 | 25 | ->method('updateLogin') |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | public $admin_user_uuid = 'uuid'; |
50 | 50 | }; |
51 | 51 | $bcrypt = $this->getMockBuilder(\Zend\Crypt\Password\Bcrypt::class) |
52 | - ->setMethods(['verify']) |
|
52 | + ->setMethods([ 'verify' ]) |
|
53 | 53 | ->getMock(); |
54 | 54 | $bcrypt->expects(static::once()) |
55 | 55 | ->method('verify') |
56 | 56 | ->will(static::returnValue(false)); |
57 | 57 | $adminUsersMapper = $this->getMockBuilder(\Admin\Mapper\AdminUsersMapper::class) |
58 | - ->setMethods(['getByEmail']) |
|
58 | + ->setMethods([ 'getByEmail' ]) |
|
59 | 59 | ->getMock(); |
60 | 60 | $adminUsersMapper->expects(static::once()) |
61 | 61 | ->method('getByEmail') |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $bcrypt = $this->getMockBuilder(\Zend\Crypt\Password\Bcrypt::class) |
81 | 81 | ->getMock(); |
82 | 82 | $adminUsersMapper = $this->getMockBuilder(\Admin\Mapper\AdminUsersMapper::class) |
83 | - ->setMethods(['getByEmail']) |
|
83 | + ->setMethods([ 'getByEmail' ]) |
|
84 | 84 | ->getMock(); |
85 | 85 | $adminUsersMapper->expects(static::once()) |
86 | 86 | ->method('getByEmail') |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | $session = new \Zend\Session\SessionManager(); |
10 | 10 | $router = $this->getMockBuilder('Zend\Expressive\Router\RouterInterface') |
11 | - ->setMethods(['generateUri']) |
|
11 | + ->setMethods([ 'generateUri' ]) |
|
12 | 12 | ->getMockForAbstractClass(); |
13 | 13 | $router->expects(static::at(0)) |
14 | 14 | ->method('generateUri') |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | $response = new \Zend\Diactoros\Response(); |
18 | 18 | $adminAuthMiddleware = new \Admin\Middleware\AdminAuth($router, $session); |
19 | 19 | /** @var \Zend\Diactoros\Response $response */ |
20 | - $response = $adminAuthMiddleware($request, $response, function ($request, $response) { |
|
20 | + $response = $adminAuthMiddleware($request, $response, function($request, $response) { |
|
21 | 21 | |
22 | 22 | }); |
23 | 23 | static::assertSame(302, $response->getStatusCode()); |
24 | - static::assertSame(['http://unfinished.dev/admin/login'], $response->getHeader('Location')); |
|
24 | + static::assertSame([ 'http://unfinished.dev/admin/login' ], $response->getHeader('Location')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function testExecutionShouldContinueFurtherIfUserIsLoggedIn() |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $request = new \Zend\Diactoros\ServerRequest(); |
40 | 40 | $response = new \Zend\Diactoros\Response(); |
41 | 41 | $adminAuthMiddleware = new \Admin\Middleware\AdminAuth($router, $session); |
42 | - $middlewareResponse = $adminAuthMiddleware($request, $response, function ($request, $response) { |
|
42 | + $middlewareResponse = $adminAuthMiddleware($request, $response, function($request, $response) { |
|
43 | 43 | return $response; |
44 | 44 | }); |
45 | 45 | static::assertSame($response, $middlewareResponse); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | ->disableOriginalConstructor() |
11 | 11 | ->getMockForAbstractClass(); |
12 | 12 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
13 | - ->setMethods(['get']) |
|
13 | + ->setMethods([ 'get' ]) |
|
14 | 14 | ->getMockForAbstractClass(); |
15 | 15 | $container->expects(static::at(0)) |
16 | 16 | ->method('get') |
@@ -7,7 +7,7 @@ |
||
7 | 7 | public function testSessionFactoryShouldCreateInstanceOfSessionManager() |
8 | 8 | { |
9 | 9 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
10 | - ->setMethods(['get']) |
|
10 | + ->setMethods([ 'get' ]) |
|
11 | 11 | ->getMockForAbstractClass(); |
12 | 12 | $sessionFactory = new \Admin\Factory\SessionFactory(); |
13 | 13 | static::assertInstanceOf(\Zend\Session\SessionManager::class, $sessionFactory($container)); |