@@ -90,7 +90,7 @@ |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | $v = new Validator(new Definitions()); |
93 | - $v->validate('{' . $key . '}', [ |
|
93 | + $v->validate('{'.$key.'}', [ |
|
94 | 94 | $key => [ |
95 | 95 | 'type' => 'highlight', |
96 | 96 | 'id' => 'identifier', |
@@ -58,18 +58,18 @@ |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | public function validateParameter($parameter, $data) { |
61 | - $this->assertTrue(is_array($data), 'Parameter ' . $parameter . ' is invalid'); |
|
61 | + $this->assertTrue(is_array($data), 'Parameter '.$parameter.' is invalid'); |
|
62 | 62 | $this->assertArrayHasKey('since', $data); |
63 | - $this->assertNotEmpty($data['since'], 'Since of parameter ' . $parameter . ' must not be empty'); |
|
63 | + $this->assertNotEmpty($data['since'], 'Since of parameter '.$parameter.' must not be empty'); |
|
64 | 64 | $this->assertArrayHasKey('required', $data); |
65 | - $this->assertTrue(is_bool($data['required']), 'Required of parameter ' . $parameter . ' must be a boolean'); |
|
65 | + $this->assertTrue(is_bool($data['required']), 'Required of parameter '.$parameter.' must be a boolean'); |
|
66 | 66 | if ($parameter === 'id' || $parameter === 'name') { |
67 | - $this->assertTrue($data['required'], 'Parameter ' . $parameter . ' must be required'); |
|
67 | + $this->assertTrue($data['required'], 'Parameter '.$parameter.' must be required'); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $this->assertArrayHasKey('description', $data); |
71 | - $this->assertNotEquals('', $data['description'], 'Description of parameter ' . $parameter . ' must not be empty'); |
|
71 | + $this->assertNotEquals('', $data['description'], 'Description of parameter '.$parameter.' must not be empty'); |
|
72 | 72 | $this->assertArrayHasKey('example', $data); |
73 | - $this->assertNotEquals('', $data['example'], 'Example of parameter ' . $parameter . ' must not be empty'); |
|
73 | + $this->assertNotEquals('', $data['example'], 'Example of parameter '.$parameter.' must not be empty'); |
|
74 | 74 | } |
75 | 75 | } |
@@ -445,7 +445,7 @@ |
||
445 | 445 | $this->config->expects($this->any()) |
446 | 446 | ->method('getAppValue') |
447 | 447 | ->willReturnCallback( |
448 | - function ($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration, $groupSharingDisabled) { |
|
448 | + function($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration, $groupSharingDisabled) { |
|
449 | 449 | if ($appName !== 'core') { |
450 | 450 | return $default; |
451 | 451 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->userSession->expects($this->any())->method('getUser') |
53 | 53 | ->willReturn($user); |
54 | 54 | $this->cloudIdManager->expects($this->any())->method('resolveCloudId') |
55 | - ->willReturnCallback(function ($cloudId) { |
|
55 | + ->willReturnCallback(function($cloudId) { |
|
56 | 56 | if ($cloudId === '[email protected]') { |
57 | 57 | return new CloudId('[email protected]', 'user', 'myNextcloud.net'); |
58 | 58 | } |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | $client = $this->createMock(IClient::class); |
163 | 163 | $client->expects($this->once()) |
164 | 164 | ->method('get') |
165 | - ->willReturnCallback(function ($url) use ($searchParams, $response) { |
|
166 | - $this->assertSame(strpos($url, $searchParams['server'] . '/users?search='), 0); |
|
165 | + ->willReturnCallback(function($url) use ($searchParams, $response) { |
|
166 | + $this->assertSame(strpos($url, $searchParams['server'].'/users?search='), 0); |
|
167 | 167 | $this->assertNotFalse(strpos($url, urlencode($searchParams['search']))); |
168 | 168 | return $response; |
169 | 169 | }); |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | $client = $this->createMock(IClient::class); |
227 | 227 | $client->expects($this->once()) |
228 | 228 | ->method('get') |
229 | - ->willReturnCallback(function ($url) use ($searchParams, $response) { |
|
230 | - $this->assertSame(strpos($url, $searchParams['server'] . '/users?search='), 0); |
|
229 | + ->willReturnCallback(function($url) use ($searchParams, $response) { |
|
230 | + $this->assertSame(strpos($url, $searchParams['server'].'/users?search='), 0); |
|
231 | 231 | $this->assertNotFalse(strpos($url, urlencode($searchParams['search']))); |
232 | 232 | return $response; |
233 | 233 | }); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | 'extra' => ['federationId' => $fedIDs[2]], |
324 | 324 | ], |
325 | 325 | ] |
326 | - ],// GS , Lookup |
|
326 | + ], // GS , Lookup |
|
327 | 327 | true, true |
328 | 328 | ], |
329 | 329 | [[ |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'extra' => ['federationId' => $fedIDs[2]], |
366 | 366 | ], |
367 | 367 | ] |
368 | - ],// GS , Lookup |
|
368 | + ], // GS , Lookup |
|
369 | 369 | true, false |
370 | 370 | ], |
371 | 371 | [[ |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'extra' => ['federationId' => $fedIDs[2]], |
405 | 405 | ], |
406 | 406 | ] |
407 | - ],// GS , Lookup |
|
407 | + ], // GS , Lookup |
|
408 | 408 | false, true |
409 | 409 | ], |
410 | 410 | [[ |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | 'extra' => ['federationId' => $fedIDs[2]], |
444 | 444 | ], |
445 | 445 | ] |
446 | - ],// GS , Lookup |
|
446 | + ], // GS , Lookup |
|
447 | 447 | false, false |
448 | 448 | ], |
449 | 449 | ]; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $this->config->expects($this->any()) |
91 | 91 | ->method('getAppValue') |
92 | 92 | ->willReturnCallback( |
93 | - function ($appName, $key, $default) use ($mockedSettings) { |
|
93 | + function($appName, $key, $default) use ($mockedSettings) { |
|
94 | 94 | return $mockedSettings[$appName][$key] ?? $default; |
95 | 95 | } |
96 | 96 | ); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | ): void { |
446 | 446 | $this->mockConfig(['core' => [ |
447 | 447 | 'shareapi_only_share_with_group_members' => $shareWithGroupOnly ? 'yes' : 'no', |
448 | - 'shareapi_allow_share_dialog_user_enumeration' => $shareeEnumeration? 'yes' : 'no', |
|
448 | + 'shareapi_allow_share_dialog_user_enumeration' => $shareeEnumeration ? 'yes' : 'no', |
|
449 | 449 | 'shareapi_restrict_user_enumeration_to_group' => false ? 'yes' : 'no', |
450 | 450 | 'shareapi_restrict_user_enumeration_to_phone' => $shareeEnumerationPhone ? 'yes' : 'no', |
451 | 451 | ]]); |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | $this->session->expects($this->once()) |
546 | 546 | ->method('getUser') |
547 | - ->willReturnCallback(function () use ($currentUserId) { |
|
547 | + ->willReturnCallback(function() use ($currentUserId) { |
|
548 | 548 | if ($currentUserId !== null) { |
549 | 549 | return $this->getUserMock($currentUserId, $currentUserId); |
550 | 550 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | $usersById[$user['uid']] = $user; |
733 | 733 | } |
734 | 734 | |
735 | - $mappedResultExact = array_map(function ($user) use ($usersById, $search) { |
|
735 | + $mappedResultExact = array_map(function($user) use ($usersById, $search) { |
|
736 | 736 | return [ |
737 | 737 | 'label' => $search === $user ? $user : $usersById[$user]['displayName'], |
738 | 738 | 'value' => ['shareType' => 0, 'shareWith' => $user], |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | 'shareWithDisplayNameUnique' => $user, |
743 | 743 | ]; |
744 | 744 | }, $result['exact']); |
745 | - $mappedResultWide = array_map(function ($user) { |
|
745 | + $mappedResultWide = array_map(function($user) { |
|
746 | 746 | return [ |
747 | 747 | 'label' => $user, |
748 | 748 | 'value' => ['shareType' => 0, 'shareWith' => $user], |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | |
756 | 756 | $this->userManager |
757 | 757 | ->method('get') |
758 | - ->willReturnCallback(function ($userId) use ($userResults) { |
|
758 | + ->willReturnCallback(function($userId) use ($userResults) { |
|
759 | 759 | if (isset($userResults[$userId])) { |
760 | 760 | return $this->getUserMock($userId, $userId); |
761 | 761 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | }); |
764 | 764 | $this->userManager |
765 | 765 | ->method('searchDisplayName') |
766 | - ->willReturnCallback(function ($search) use ($matchingUsers) { |
|
766 | + ->willReturnCallback(function($search) use ($matchingUsers) { |
|
767 | 767 | $users = array_filter( |
768 | 768 | $matchingUsers, |
769 | 769 | fn ($user) => str_contains(strtolower($user['displayName']), strtolower($search)) |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | ->willReturn($this->getUserMock('test', 'foo')); |
783 | 783 | $this->groupManager->expects($this->any()) |
784 | 784 | ->method('getUserGroupIds') |
785 | - ->willReturnCallback(function ($user) use ($matchingUsers, $userGroups) { |
|
785 | + ->willReturnCallback(function($user) use ($matchingUsers, $userGroups) { |
|
786 | 786 | static $firstCall = true; |
787 | 787 | if ($firstCall) { |
788 | 788 | $firstCall = false; |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | } |
792 | 792 | $neededObject = array_filter( |
793 | 793 | $matchingUsers, |
794 | - function ($e) use ($user) { |
|
794 | + function($e) use ($user) { |
|
795 | 795 | return $user->getUID() === $e['uid']; |
796 | 796 | } |
797 | 797 | ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->config->expects($this->any()) |
84 | 84 | ->method('getAppValue') |
85 | 85 | ->willReturnCallback( |
86 | - function ($appName, $key, $default) use ($shareeEnumeration) { |
|
86 | + function($appName, $key, $default) use ($shareeEnumeration) { |
|
87 | 87 | if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { |
88 | 88 | return $shareeEnumeration ? 'yes' : 'no'; |
89 | 89 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $this->contactsManager->expects($this->any()) |
97 | 97 | ->method('search') |
98 | - ->willReturnCallback(function ($search, $searchAttributes) use ($searchTerm, $contacts) { |
|
98 | + ->willReturnCallback(function($search, $searchAttributes) use ($searchTerm, $contacts) { |
|
99 | 99 | if ($search === $searchTerm) { |
100 | 100 | return $contacts; |
101 | 101 | } |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | foreach ($userPrefix as $user) { |
394 | 394 | foreach ($remotes as $remote) { |
395 | 395 | foreach ($protocols as $protocol) { |
396 | - $baseUrl = $user . '@' . $protocol . $remote; |
|
396 | + $baseUrl = $user.'@'.$protocol.$remote; |
|
397 | 397 | |
398 | 398 | if ($protocol === 'https://') { |
399 | 399 | // https:// protocol is not expected in the final result |
400 | 400 | $protocol = ''; |
401 | 401 | } |
402 | 402 | |
403 | - $testCases[] = [$baseUrl, $user, $protocol . $remote]; |
|
404 | - $testCases[] = [$baseUrl . '/', $user, $protocol . $remote]; |
|
405 | - $testCases[] = [$baseUrl . '/index.php', $user, $protocol . $remote]; |
|
406 | - $testCases[] = [$baseUrl . '/index.php/s/token', $user, $protocol . $remote]; |
|
403 | + $testCases[] = [$baseUrl, $user, $protocol.$remote]; |
|
404 | + $testCases[] = [$baseUrl.'/', $user, $protocol.$remote]; |
|
405 | + $testCases[] = [$baseUrl.'/index.php', $user, $protocol.$remote]; |
|
406 | + $testCases[] = [$baseUrl.'/index.php/s/token', $user, $protocol.$remote]; |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $userPlugin = $this->createMock(ISearchPlugin::class); |
50 | 50 | $userPlugin->expects($this->any()) |
51 | 51 | ->method('search') |
52 | - ->willReturnCallback(function () use ($searchResult, $mockedUserResult, $expectedMoreResults) { |
|
52 | + ->willReturnCallback(function() use ($searchResult, $mockedUserResult, $expectedMoreResults) { |
|
53 | 53 | $type = new SearchResultType('users'); |
54 | 54 | $searchResult->addResultSet($type, $mockedUserResult); |
55 | 55 | return $expectedMoreResults; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $groupPlugin = $this->createMock(ISearchPlugin::class); |
59 | 59 | $groupPlugin->expects($this->any()) |
60 | 60 | ->method('search') |
61 | - ->willReturnCallback(function () use ($searchResult, $mockedGroupsResult, $expectedMoreResults) { |
|
61 | + ->willReturnCallback(function() use ($searchResult, $mockedGroupsResult, $expectedMoreResults) { |
|
62 | 62 | $type = new SearchResultType('groups'); |
63 | 63 | $searchResult->addResultSet($type, $mockedGroupsResult); |
64 | 64 | return $expectedMoreResults; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $remotePlugin = $this->createMock(ISearchPlugin::class); |
68 | 68 | $remotePlugin->expects($this->any()) |
69 | 69 | ->method('search') |
70 | - ->willReturnCallback(function () use ($searchResult, $mockedRemotesResult, $expectedMoreResults) { |
|
70 | + ->willReturnCallback(function() use ($searchResult, $mockedRemotesResult, $expectedMoreResults) { |
|
71 | 71 | if ($mockedRemotesResult !== null) { |
72 | 72 | $type = new SearchResultType('remotes'); |
73 | 73 | $searchResult->addResultSet($type, $mockedRemotesResult['results'], $mockedRemotesResult['exact']); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $mailPlugin = $this->createMock(ISearchPlugin::class); |
82 | 82 | $mailPlugin->expects($this->any()) |
83 | 83 | ->method('search') |
84 | - ->willReturnCallback(function () use ($searchResult, $mockedMailResult, $expectedMoreResults) { |
|
84 | + ->willReturnCallback(function() use ($searchResult, $mockedMailResult, $expectedMoreResults) { |
|
85 | 85 | $type = new SearchResultType('emails'); |
86 | 86 | $searchResult->addResultSet($type, $mockedMailResult); |
87 | 87 | return $expectedMoreResults; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->container->expects($this->any()) |
91 | 91 | ->method('resolve') |
92 | - ->willReturnCallback(function ($class) use ($searchResult, $userPlugin, $groupPlugin, $remotePlugin, $mailPlugin) { |
|
92 | + ->willReturnCallback(function($class) use ($searchResult, $userPlugin, $groupPlugin, $remotePlugin, $mailPlugin) { |
|
93 | 93 | if ($class === SearchResult::class) { |
94 | 94 | return $searchResult; |
95 | 95 | } elseif ($class === $userPlugin) { |
@@ -214,24 +214,24 @@ discard block |
||
214 | 214 | [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE, IShare::TYPE_EMAIL], // plugins |
215 | 215 | 1, // page |
216 | 216 | 10, // per page |
217 | - [ // user result |
|
217 | + [// user result |
|
218 | 218 | ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']], |
219 | 219 | ], |
220 | - [ // group result |
|
220 | + [// group result |
|
221 | 221 | ['label' => 'testgroup1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'testgroup1']], |
222 | 222 | ], |
223 | - [ // remote result |
|
223 | + [// remote result |
|
224 | 224 | 'results' => [ |
225 | - ['label' => '[email protected]', 'uuid' => 'f3d78140-abcc-46df-b58d-c7cc1176aadf','value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => '[email protected]']] |
|
225 | + ['label' => '[email protected]', 'uuid' => 'f3d78140-abcc-46df-b58d-c7cc1176aadf', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => '[email protected]']] |
|
226 | 226 | ], |
227 | 227 | 'exact' => [], |
228 | 228 | 'exactIdMatch' => false, |
229 | 229 | ], |
230 | - [ // mail result |
|
230 | + [// mail result |
|
231 | 231 | ['label' => 'test Two', 'uuid' => 'b2321e9e-31af-43ac-a406-583fb26d1964', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => '[email protected]']], |
232 | 232 | ['label' => 'test One', 'uuid' => 'f3d78140-abcc-46df-b58d-c7cc1176aadf', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => '[email protected]']], |
233 | 233 | ], |
234 | - [ // expected result |
|
234 | + [// expected result |
|
235 | 235 | 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []], |
236 | 236 | 'users' => [ |
237 | 237 | ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']], |
@@ -24,12 +24,12 @@ |
||
24 | 24 | $this->crypto = $this->createMock(ICrypto::class); |
25 | 25 | $this->crypto->expects($this->any()) |
26 | 26 | ->method('encrypt') |
27 | - ->willReturnCallback(function ($input) { |
|
28 | - return '#' . $input . '#'; |
|
27 | + ->willReturnCallback(function($input) { |
|
28 | + return '#'.$input.'#'; |
|
29 | 29 | }); |
30 | 30 | $this->crypto->expects($this->any()) |
31 | 31 | ->method('decrypt') |
32 | - ->willReturnCallback(function ($input) { |
|
32 | + ->willReturnCallback(function($input) { |
|
33 | 33 | if ($input === '') { |
34 | 34 | return ''; |
35 | 35 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | ->getMock(); |
33 | 33 | $this->crypto->expects($this->any()) |
34 | 34 | ->method('encrypt') |
35 | - ->willReturnCallback(function ($input) { |
|
35 | + ->willReturnCallback(function($input) { |
|
36 | 36 | return $input; |
37 | 37 | }); |
38 | 38 | $this->crypto->expects($this->any()) |
39 | 39 | ->method('decrypt') |
40 | - ->willReturnCallback(function ($input) { |
|
40 | + ->willReturnCallback(function($input) { |
|
41 | 41 | if ($input === '') { |
42 | 42 | return ''; |
43 | 43 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->wrappedSession->expects($this->once()) |
55 | 55 | ->method('get') |
56 | 56 | ->with('encrypted_session_data') |
57 | - ->willReturnCallback(function () use ($encryptedValue) { |
|
57 | + ->willReturnCallback(function() use ($encryptedValue) { |
|
58 | 58 | return $encryptedValue; |
59 | 59 | }); |
60 | 60 |