@@ -4,11 +4,11 @@ discard block |
||
| 4 | 4 | use Modules\Schedule\Entities\Schedule; |
| 5 | 5 | use Modules\Schedule\Entities\WeekDay; |
| 6 | 6 | |
| 7 | -$factory->define(Schedule::class, function (Faker $faker) { |
|
| 8 | - $times = []; |
|
| 7 | +$factory->define(Schedule::class, function(Faker $faker) { |
|
| 8 | + $times = [ ]; |
|
| 9 | 9 | for ($d = 0; $d < 7; $d++) { |
| 10 | 10 | for ($h = 0; $h < 24; $h++) { |
| 11 | - $times[$d][$h] = $faker->boolean; |
|
| 11 | + $times[ $d ][ $h ] = $faker->boolean; |
|
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | Schedule::WEEK_DAYS => [ |
| 21 | 21 | WeekDay::MONDAY => WeekDay::fromFactory()->raw(), |
| 22 | 22 | ], |
| 23 | - Schedule::EXCEPTIONS => [], |
|
| 23 | + Schedule::EXCEPTIONS => [ ], |
|
| 24 | 24 | Schedule::RANDOMIZE => $faker->boolean, |
| 25 | 25 | ]; |
| 26 | 26 | }); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | private function getAuth0Service() : Auth0Service |
| 22 | 22 | { |
| 23 | - return once(function () { |
|
| 23 | + return once(function() { |
|
| 24 | 24 | return app()->make(Auth0ServiceContract::class); |
| 25 | 25 | }); |
| 26 | 26 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | private function getUserAuth0Token() |
| 37 | 37 | { |
| 38 | - return Cache::remember('testing:http_access_token', 60 * 60, function () { |
|
| 38 | + return Cache::remember('testing:http_access_token', 60 * 60, function() { |
|
| 39 | 39 | try { |
| 40 | 40 | $httpClient = new Client(); |
| 41 | 41 | $response = $httpClient->post(env('AUTH0_DOMAIN').'oauth/token', [ |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | use Auth0TestUser, UserTestRoles; |
| 20 | 20 | |
| 21 | - protected function http(string $method, string $route, array $payload = [], array $headers = []): TestResponse |
|
| 21 | + protected function http(string $method, string $route, array $payload = [ ], array $headers = [ ]): TestResponse |
|
| 22 | 22 | { |
| 23 | - $headers['Authorization'] = 'Bearer '.$this->getUserAuth0Token()->id_token; |
|
| 23 | + $headers[ 'Authorization' ] = 'Bearer '.$this->getUserAuth0Token()->id_token; |
|
| 24 | 24 | |
| 25 | 25 | return parent::http($method, $route, $payload, $headers); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function httpNoAuth(string $method, string $route, array $payload = [], array $headers = []): TestResponse |
|
| 28 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ], array $headers = [ ]): TestResponse |
|
| 29 | 29 | { |
| 30 | 30 | return parent::http($method, $route, $payload, $headers); |
| 31 | 31 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function actingAs($user, $driver = null) |
| 39 | 39 | { |
| 40 | - if (! $user->is($this->getTestUser())) { |
|
| 40 | + if (!$user->is($this->getTestUser())) { |
|
| 41 | 41 | throw new \Foundation\Exceptions\Exception('cannot set another user for authorized http tests. Sync other roles/permissions instead.'); |
| 42 | 42 | } |
| 43 | 43 | parent::actingAs($user, $driver); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function read($id) |
| 45 | 45 | { |
| 46 | - if (! $this->service->find($id)->notifiable()->is(auth()->user())) { |
|
| 46 | + if (!$this->service->find($id)->notifiable()->is(auth()->user())) { |
|
| 47 | 47 | throw new NotFoundHttpException('notification not found'); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function unread($id) |
| 58 | 58 | { |
| 59 | - if (! $this->service->find($id)->notifiable()->is(auth()->user())) { |
|
| 59 | + if (!$this->service->find($id)->notifiable()->is(auth()->user())) { |
|
| 60 | 60 | throw new NotFoundHttpException('notification not found'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,8 +66,8 @@ |
||
| 66 | 66 | |
| 67 | 67 | public function setRoles($id, array $roles): void |
| 68 | 68 | { |
| 69 | - if (! in_array(Role::MEMBER, $roles)) { |
|
| 70 | - $roles[] = Role::MEMBER; |
|
| 69 | + if (!in_array(Role::MEMBER, $roles)) { |
|
| 70 | + $roles[ ] = Role::MEMBER; |
|
| 71 | 71 | } |
| 72 | 72 | $this->find($id)->syncRoles($roles); |
| 73 | 73 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use Faker\Generator as Faker; |
| 4 | 4 | use Modules\Proxy\Entities\Proxy; |
| 5 | 5 | |
| 6 | -$factory->define(Proxy::class, function (Faker $faker) { |
|
| 6 | +$factory->define(Proxy::class, function(Faker $faker) { |
|
| 7 | 7 | return [ |
| 8 | 8 | 'alias' => $faker->userName.' proxy', |
| 9 | 9 | 'user_id' => null, |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | 'username' => $faker->unique()->userName, |
| 13 | 13 | 'password' => $faker->password, |
| 14 | 14 | 'online' => $faker->boolean(85), |
| 15 | - 'uptime' => $faker->numberBetween(0,100), |
|
| 16 | - 'type' => get_random_array_element(['SOCKS5', 'SOCKS4', 'HTTP', 'HTTPS']), |
|
| 15 | + 'uptime' => $faker->numberBetween(0, 100), |
|
| 16 | + 'type' => get_random_array_element([ 'SOCKS5', 'SOCKS4', 'HTTP', 'HTTPS' ]), |
|
| 17 | 17 | 'monitor' => $faker->boolean, |
| 18 | - 'anonimity_level' => get_random_array_element(['ELITE', 'ANONYMOUS', 'TRANSPARANT']), |
|
| 18 | + 'anonimity_level' => get_random_array_element([ 'ELITE', 'ANONYMOUS', 'TRANSPARANT' ]), |
|
| 19 | 19 | 'last_alive_at' => \Carbon\Carbon::now()->subMinutes($faker->numberBetween(0, 24 * 60)), |
| 20 | 20 | 'last_checked_at' => \Carbon\Carbon::now()->subMinutes($faker->numberBetween(0, 24 * 60)), |
| 21 | 21 | ]; |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | function get_module_path(string $module) |
| 5 | 5 | { |
| 6 | 6 | $module = ucfirst($module); |
| 7 | - $path = base_path('src/Modules') . '/' . $module; |
|
| 7 | + $path = base_path('src/Modules').'/'.$module; |
|
| 8 | 8 | if (file_exists($path)) { |
| 9 | 9 | return $path; |
| 10 | 10 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | $randomIndex = random_int(0, count($array) - 1); |
| 62 | 62 | |
| 63 | - return $array[$randomIndex]; |
|
| 63 | + return $array[ $randomIndex ]; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | if (!function_exists('create_multiple_from_factory')) { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $traits = array_flip(class_uses_recursive($class)); |
| 111 | 111 | |
| 112 | - return isset($traits[$trait]); |
|
| 112 | + return isset($traits[ $trait ]); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | if (!function_exists('array_keys_exists')) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if (!function_exists('is_associative_array')) { |
| 154 | 154 | function is_associative_array(array $arr) |
| 155 | 155 | { |
| 156 | - if ([] === $arr) { |
|
| 156 | + if ([ ] === $arr) { |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $i = 0; |
| 233 | 233 | foreach ($splittedInCapsName as $word) { |
| 234 | 234 | if ($i !== 0) |
| 235 | - $splittedString = $splittedString . $word . '_'; |
|
| 235 | + $splittedString = $splittedString.$word.'_'; |
|
| 236 | 236 | $i++; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | public function testGetClassConstants() |
| 177 | 177 | { |
| 178 | 178 | $this->assertArrayHasKey('TEST_CONSTANT', get_class_constants(static::class)); |
| 179 | - $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)['TEST_CONSTANT']); |
|
| 179 | + $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)[ 'TEST_CONSTANT' ]); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function testInstanceWithoutConstructor() |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $this->assertInstanceOf(Larapi::class, instance_without_constructor(Larapi::class)); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function testSplitCapitalStringToUnderscores(){ |
|
| 187 | + public function testSplitCapitalStringToUnderscores() { |
|
| 188 | 188 | $this->assertEquals("proxy_uptime_collection", split_caps_to_underscore("ProxyUptimeCollection")); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function getDispatchedEvents(?string $class): array |
| 23 | 23 | { |
| 24 | - $events = []; |
|
| 25 | - Event::assertDispatched($class, function ($event) use (&$events) { |
|
| 26 | - $events[] = $event; |
|
| 24 | + $events = [ ]; |
|
| 25 | + Event::assertDispatched($class, function($event) use (&$events) { |
|
| 26 | + $events[ ] = $event; |
|
| 27 | 27 | return true; |
| 28 | 28 | }); |
| 29 | 29 | return $events; |
@@ -38,6 +38,6 @@ discard block |
||
| 38 | 38 | $events = $this->getDispatchedEvents($class); |
| 39 | 39 | if (empty($events)) |
| 40 | 40 | return null; |
| 41 | - return $events[0]; |
|
| 41 | + return $events[ 0 ]; |
|
| 42 | 42 | } |
| 43 | 43 | } |