@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function getRole(): string |
| 20 | 20 | { |
| 21 | - if (! isset($role)) { |
|
| 21 | + if (!isset($role)) { |
|
| 22 | 22 | throw new Exception('Role not set for permission '.get_short_class_name(static::class)); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public static function get(): array |
| 29 | 29 | { |
| 30 | - return once(function () { |
|
| 30 | + return once(function() { |
|
| 31 | 31 | return new static; |
| 32 | 32 | })->getPermissions(); |
| 33 | 33 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | 'exceptions' => $schedule->exceptions, |
| 37 | 37 | 'randomize' => $schedule->randomize, |
| 38 | 38 | 'times' => $schedule->times, //$this->buildTimes($schedule->week_days), |
| 39 | - 'accounts' => [], |
|
| 39 | + 'accounts' => [ ], |
|
| 40 | 40 | 'created_at' => $schedule->created_at, |
| 41 | 41 | 'updated_at' => $schedule->updated_at, |
| 42 | 42 | ]; |
@@ -44,6 +44,6 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function buildTimes($weekDays): array |
| 46 | 46 | { |
| 47 | - return []; |
|
| 47 | + return [ ]; |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -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 | } |
@@ -59,8 +59,9 @@ |
||
| 59 | 59 | { |
| 60 | 60 | return once(function () { |
| 61 | 61 | $option = $this->option('sync'); |
| 62 | - if ($option !== null) |
|
| 63 | - $option = (bool)$option; |
|
| 62 | + if ($option !== null) { |
|
| 63 | + $option = (bool)$option; |
|
| 64 | + } |
|
| 64 | 65 | |
| 65 | 66 | return $option === null ? $this->confirm('Should the job run Synchronously?', false) : $option; |
| 66 | 67 | }); |
@@ -60,16 +60,16 @@ |
||
| 60 | 60 | protected function setOptions() :array |
| 61 | 61 | { |
| 62 | 62 | return [ |
| 63 | - ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.'], |
|
| 63 | + [ 'sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.' ], |
|
| 64 | 64 | ]; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function isJobSynchronous(): bool |
| 68 | 68 | { |
| 69 | - return once(function () { |
|
| 69 | + return once(function() { |
|
| 70 | 70 | $option = $this->option('sync'); |
| 71 | 71 | if ($option !== null) |
| 72 | - $option = (bool)$option; |
|
| 72 | + $option = (bool) $option; |
|
| 73 | 73 | |
| 74 | 74 | return $option === null ? $this->confirm('Should the job run Synchronously?', false) : $option; |
| 75 | 75 | }); |
@@ -71,8 +71,9 @@ |
||
| 71 | 71 | { |
| 72 | 72 | return once(function () { |
| 73 | 73 | $option = $this->option('mongo'); |
| 74 | - if ($option !== null) |
|
| 75 | - $option = (bool)$option; |
|
| 74 | + if ($option !== null) { |
|
| 75 | + $option = (bool)$option; |
|
| 76 | + } |
|
| 76 | 77 | |
| 77 | 78 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
| 78 | 79 | }); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function getTableName(): string |
| 60 | 60 | { |
| 61 | - return once(function () { |
|
| 61 | + return once(function() { |
|
| 62 | 62 | return $this->option('table') ?? $this->ask('What is the name of the table/collection?', strtolower(Str::plural($this->getModuleName()))); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | protected function setOptions() :array |
| 72 | 72 | { |
| 73 | 73 | return [ |
| 74 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null], |
|
| 75 | - ['table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null], |
|
| 74 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo migration.', null ], |
|
| 75 | + [ 'table', null, InputOption::VALUE_OPTIONAL, 'Name of the table/collection.', null ], |
|
| 76 | 76 | ]; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | protected function isMongoMigration(): bool |
| 80 | 80 | { |
| 81 | - return once(function () { |
|
| 81 | + return once(function() { |
|
| 82 | 82 | $option = $this->option('mongo'); |
| 83 | 83 | if ($option !== null) |
| 84 | - $option = (bool)$option; |
|
| 84 | + $option = (bool) $option; |
|
| 85 | 85 | |
| 86 | 86 | return $option === null ? $this->confirm('Is this migration for a mongodb database?', false) : $option; |
| 87 | 87 | }); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function getDestinationFilePath() :string |
| 106 | 106 | { |
| 107 | - return $this->getModule()->getPath() . $this->filePath . '/' . $this->getDestinationFileName() . '.php'; |
|
| 107 | + return $this->getModule()->getPath().$this->filePath.'/'.$this->getDestinationFileName().'.php'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -112,6 +112,6 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function getDestinationFileName() |
| 114 | 114 | { |
| 115 | - return date('Y_m_d_His_') . split_caps_to_underscore($this->getClassName()); |
|
| 115 | + return date('Y_m_d_His_').split_caps_to_underscore($this->getClassName()); |
|
| 116 | 116 | } |
| 117 | 117 | } |