@@ -14,9 +14,9 @@ |
||
14 | 14 | use Modules\Authorization\Entities\Permission; |
15 | 15 | use \Modules\Machine\Permissions\MachinePermissions; |
16 | 16 | |
17 | -Route::get('/{id}', 'MachineController@show')->middleware(['permission:'.MachinePermissions::SHOW_MACHINE]); |
|
18 | -Route::patch('/{id}', 'MachineController@update')->middleware(['permission:'.MachinePermissions::UPDATE_MACHINE]); |
|
19 | -Route::delete('/{id}', 'MachineController@destroy')->middleware(['permission:'.MachinePermissions::DELETE_MACHINE]); |
|
17 | +Route::get('/{id}', 'MachineController@show')->middleware([ 'permission:'.MachinePermissions::SHOW_MACHINE ]); |
|
18 | +Route::patch('/{id}', 'MachineController@update')->middleware([ 'permission:'.MachinePermissions::UPDATE_MACHINE ]); |
|
19 | +Route::delete('/{id}', 'MachineController@destroy')->middleware([ 'permission:'.MachinePermissions::DELETE_MACHINE ]); |
|
20 | 20 | |
21 | -Route::post('/', 'MachineController@store')->middleware(['permission:'.MachinePermissions::CREATE_MACHINE]); |
|
22 | -Route::get('/', 'MachineController@index')->middleware(['permission:'.MachinePermissions::SHOW_MACHINE]); |
|
21 | +Route::post('/', 'MachineController@store')->middleware([ 'permission:'.MachinePermissions::CREATE_MACHINE ]); |
|
22 | +Route::get('/', 'MachineController@index')->middleware([ 'permission:'.MachinePermissions::SHOW_MACHINE ]); |
@@ -13,9 +13,9 @@ |
||
13 | 13 | |
14 | 14 | use \Modules\Proxy\Permissions\ProxyPermissions; |
15 | 15 | |
16 | -Route::get('/{id}', 'ProxyController@show')->middleware(['permission:'.ProxyPermissions::SHOW_PROXY]); |
|
17 | -Route::patch('/{id}', 'ProxyController@update')->middleware(['permission:'.ProxyPermissions::UPDATE_PROXY]); |
|
18 | -Route::delete('/{id}', 'ProxyController@destroy')->middleware(['permission:'.ProxyPermissions::DELETE_PROXY]); |
|
16 | +Route::get('/{id}', 'ProxyController@show')->middleware([ 'permission:'.ProxyPermissions::SHOW_PROXY ]); |
|
17 | +Route::patch('/{id}', 'ProxyController@update')->middleware([ 'permission:'.ProxyPermissions::UPDATE_PROXY ]); |
|
18 | +Route::delete('/{id}', 'ProxyController@destroy')->middleware([ 'permission:'.ProxyPermissions::DELETE_PROXY ]); |
|
19 | 19 | |
20 | -Route::post('/', 'ProxyController@store')->middleware(['permission:'.ProxyPermissions::CREATE_PROXY]); |
|
21 | -Route::get('/', 'ProxyController@index')->middleware(['permission:'.ProxyPermissions::INDEX_PROXY]); |
|
20 | +Route::post('/', 'ProxyController@store')->middleware([ 'permission:'.ProxyPermissions::CREATE_PROXY ]); |
|
21 | +Route::get('/', 'ProxyController@index')->middleware([ 'permission:'.ProxyPermissions::INDEX_PROXY ]); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $role = static::singleton()->role; |
26 | 26 | |
27 | 27 | if (!isset($role)) { |
28 | - throw new Exception('Role name not set for ' . get_short_class_name(static::class)); |
|
28 | + throw new Exception('Role name not set for '.get_short_class_name(static::class)); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return $role; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | if (!isset($permissions)) { |
43 | - throw new Exception('Permissions not set for role ' . get_short_class_name(static::class)); |
|
43 | + throw new Exception('Permissions not set for role '.get_short_class_name(static::class)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $permissions; |
@@ -14,12 +14,12 @@ |
||
14 | 14 | { |
15 | 15 | public static function getAllPermissions(): array |
16 | 16 | { |
17 | - return once(function () { |
|
18 | - $permissionClasses = []; |
|
17 | + return once(function() { |
|
18 | + $permissionClasses = [ ]; |
|
19 | 19 | foreach (Larapi::getModules() as $module) { |
20 | 20 | $permissionClasses = array_merge($permissionClasses, $module->getPermissions()->getClasses()); |
21 | 21 | } |
22 | - $permissions = []; |
|
22 | + $permissions = [ ]; |
|
23 | 23 | foreach ($permissionClasses as $permissionClass) { |
24 | 24 | $permissions = array_merge($permissions, get_class_constants($permissionClass)); |
25 | 25 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | protected $role = Role::SCRIPTER; |
17 | 17 | |
18 | - protected function permissions(){ |
|
18 | + protected function permissions() { |
|
19 | 19 | return MemberRole::getPermissions(); |
20 | 20 | } |
21 | 21 | } |
@@ -15,5 +15,5 @@ |
||
15 | 15 | { |
16 | 16 | protected $role = Role::GUEST; |
17 | 17 | |
18 | - protected $permissions = []; |
|
18 | + protected $permissions = [ ]; |
|
19 | 19 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | protected function setOptions(): array |
66 | 66 | { |
67 | 67 | return [ |
68 | - ['mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false], |
|
69 | - ['migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true], |
|
68 | + [ 'mongo', null, InputOption::VALUE_OPTIONAL, 'Mongo model.', false ], |
|
69 | + [ 'migration', null, InputOption::VALUE_OPTIONAL, 'Create migration for the model.', true ], |
|
70 | 70 | ]; |
71 | 71 | } |
72 | 72 | |
@@ -96,19 +96,19 @@ discard block |
||
96 | 96 | if ($this->isMongoModel()) { |
97 | 97 | GeneratorManager::module($this->getModuleName(), $this->isOverwriteable()) |
98 | 98 | ->createMigration( |
99 | - "Create" . ucfirst($this->getClassName()) . "Collection", |
|
99 | + "Create".ucfirst($this->getClassName())."Collection", |
|
100 | 100 | strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))), |
101 | 101 | true); |
102 | 102 | } else { |
103 | 103 | GeneratorManager::module($this->getModuleName(), $this->isOverwriteable()) |
104 | 104 | ->createMigration( |
105 | - "Create" . ucfirst($this->getClassName() . "Table"), |
|
105 | + "Create".ucfirst($this->getClassName()."Table"), |
|
106 | 106 | strtolower(split_caps_to_underscore(Str::plural($this->getClassName()))), |
107 | 107 | false); |
108 | 108 | } |
109 | 109 | } |
110 | 110 | GeneratorManager::module($this->getModuleName(), $this->isOverwriteable()) |
111 | - ->createAttribute($this->getClassName() . "Attributes"); |
|
111 | + ->createAttribute($this->getClassName()."Attributes"); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | public function setVersion($version) |
68 | 68 | { |
69 | 69 | $semverRegex = '/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Z-.]+))?(?:\+([0-9A-Z-.]+)?)?$/i'; |
70 | - if (! preg_match($semverRegex, $version, $matches)) { |
|
70 | + if (!preg_match($semverRegex, $version, $matches)) { |
|
71 | 71 | throw new \Exception('Invalid Semantic Version string provided'); |
72 | 72 | } |
73 | - $this->major = (int) $matches[1]; |
|
74 | - $this->minor = (int) $matches[2]; |
|
75 | - $this->patch = (int) $matches[3]; |
|
76 | - $this->preRelease = @$matches[4] ?: null; |
|
77 | - $this->build = @$matches[5] ?: null; |
|
73 | + $this->major = (int) $matches[ 1 ]; |
|
74 | + $this->minor = (int) $matches[ 2 ]; |
|
75 | + $this->patch = (int) $matches[ 3 ]; |
|
76 | + $this->preRelease = @$matches[ 4 ] ?: null; |
|
77 | + $this->build = @$matches[ 5 ] ?: null; |
|
78 | 78 | return $this; |
79 | 79 | } |
80 | 80 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function prefix($prefix = 'v') |
287 | 287 | { |
288 | - return $prefix . $this->toString(); |
|
288 | + return $prefix.$this->toString(); |
|
289 | 289 | } |
290 | 290 | /** |
291 | 291 | * Get the current version value as a string. |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | */ |
295 | 295 | private function toString() |
296 | 296 | { |
297 | - $version = implode('.', [$this->major, $this->minor, $this->patch]); |
|
298 | - $version .= isset($this->preRelease) ? '-' . $this->preRelease : null; |
|
299 | - $version .= isset($this->build) ? '+' . $this->build : null; |
|
297 | + $version = implode('.', [ $this->major, $this->minor, $this->patch ]); |
|
298 | + $version .= isset($this->preRelease) ? '-'.$this->preRelease : null; |
|
299 | + $version .= isset($this->build) ? '+'.$this->build : null; |
|
300 | 300 | return $version; |
301 | 301 | } |
302 | 302 | } |
@@ -44,18 +44,18 @@ |
||
44 | 44 | private function sshEncodePublicKey($privKey) |
45 | 45 | { |
46 | 46 | $keyInfo = openssl_pkey_get_details($privKey); |
47 | - $buffer = pack("N", 7) . "ssh-rsa" . |
|
48 | - $this->sshEncodeBuffer($keyInfo['rsa']['e']) . |
|
49 | - $this->sshEncodeBuffer($keyInfo['rsa']['n']); |
|
50 | - return "ssh-rsa " . base64_encode($buffer); |
|
47 | + $buffer = pack("N", 7)."ssh-rsa". |
|
48 | + $this->sshEncodeBuffer($keyInfo[ 'rsa' ][ 'e' ]). |
|
49 | + $this->sshEncodeBuffer($keyInfo[ 'rsa' ][ 'n' ]); |
|
50 | + return "ssh-rsa ".base64_encode($buffer); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | private function sshEncodeBuffer($buffer) |
54 | 54 | { |
55 | 55 | $len = strlen($buffer); |
56 | - if (ord($buffer[0]) & 0x80) { |
|
56 | + if (ord($buffer[ 0 ]) & 0x80) { |
|
57 | 57 | $len++; |
58 | - $buffer = "\x00" . $buffer; |
|
58 | + $buffer = "\x00".$buffer; |
|
59 | 59 | } |
60 | 60 | return pack("Na*", $len, $buffer); |
61 | 61 | } |
@@ -21,8 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public static function generateKeyPair($keySize = 1024): RsaKeyPair |
23 | 23 | { |
24 | - if (self::$instance === null) |
|
25 | - self::$instance = new RsaGenerator(); |
|
24 | + if (self::$instance === null) { |
|
25 | + self::$instance = new RsaGenerator(); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | return self::$instance->generate($keySize); |
28 | 29 | } |