@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | if (!$providerReflection->isSubclassOf(ServiceProvider::class)) { |
| 49 | 49 | throw new Exception( |
| 50 | - $providerReflection->getName() . ' must an instance of ' . \basename(ServiceProvider::class), |
|
| 50 | + $providerReflection->getName().' must an instance of '.\basename(ServiceProvider::class), |
|
| 51 | 51 | 1 |
| 52 | 52 | ); |
| 53 | 53 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getComponentFilePath(): string |
| 88 | 88 | { |
| 89 | - return $this->componentPath . '/' . self::FILE_NAME . self::FILE_EXT; |
|
| 89 | + return $this->componentPath.'/'.self::FILE_NAME.self::FILE_EXT; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function getComponentFileStub(): string |
| 98 | 98 | { |
| 99 | - return __DIR__ . '/stubs/component.stub'; |
|
| 99 | + return __DIR__.'/stubs/component.stub'; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $componentFile = Collection::make( |
| 123 | 123 | Finder::create() |
| 124 | 124 | ->files() |
| 125 | - ->name(self::FILE_NAME . self::FILE_EXT) |
|
| 125 | + ->name(self::FILE_NAME.self::FILE_EXT) |
|
| 126 | 126 | ->in($this->componentPath) |
| 127 | 127 | )->first(); |
| 128 | 128 | |
@@ -147,6 +147,6 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $baseDir = dirname($providerReflection->getFileName(), $classNameSpace->count()); |
| 149 | 149 | |
| 150 | - return $baseDir . '/' . self::FILE_NAME; |
|
| 150 | + return $baseDir.'/'.self::FILE_NAME; |
|
| 151 | 151 | } |
| 152 | 152 | } |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | public function registerNamespace(ReflectionClass $reflectionClass): array |
| 17 | 17 | { |
| 18 | 18 | return [ |
| 19 | - 'component' => $reflectionClass->getNamespaceName() . '\Http\ComponentControllers', |
|
| 20 | - 'api' => $reflectionClass->getNamespaceName() . '\Http\ApiControllers' |
|
| 19 | + 'component' => $reflectionClass->getNamespaceName().'\Http\ComponentControllers', |
|
| 20 | + 'api' => $reflectionClass->getNamespaceName().'\Http\ApiControllers' |
|
| 21 | 21 | ]; |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $console = $this; |
| 39 | 39 | |
| 40 | - $itemCallable = function (CliMenu $menu) use ($placeHolder, $console, $file) { |
|
| 40 | + $itemCallable = function(CliMenu $menu) use ($placeHolder, $console, $file) { |
|
| 41 | 41 | $successStyle = (new MenuStyle) |
| 42 | 42 | ->setBg('254') |
| 43 | 43 | ->setFg('166'); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ->setPromptText('Type service provider namespace. [esc] to exit') |
| 47 | 47 | ->setPlaceholderText($placeHolder) |
| 48 | 48 | ->setValidationFailedText('Please type full qualified service provider namespace') |
| 49 | - ->setValidator(function ($provider) use ($placeHolder, $console) { |
|
| 49 | + ->setValidator(function($provider) use ($placeHolder, $console) { |
|
| 50 | 50 | if (!$console->fileIsExist($provider)) { |
| 51 | 51 | $this->setValidationFailedText("Class {$provider} must be exist"); |
| 52 | 52 | return false; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ->setPromptText("Component file {$filePath} already exists!. Want to overwrite?") |
| 121 | 121 | ->setPlaceholderText(' Y / N ') |
| 122 | 122 | ->setValidationFailedText('Please choose either Y / N') |
| 123 | - ->setValidator(function ($force) { |
|
| 123 | + ->setValidator(function($force) { |
|
| 124 | 124 | return in_array(strtolower($force), ['y', 'n']); |
| 125 | 125 | })->ask(); |
| 126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | if (strtolower($force) === strtolower('N')) { |
| 130 | 130 | $menu->confirm('Component file are remained same!!!', $successStyle)->display('OK!'); |
| 131 | 131 | } elseif (strtolower($force) === strtolower('Y')) { |
| 132 | - $file->copy($filePath, \str_replace('component.php', date('dmyHis') . '.php', $filePath)); |
|
| 132 | + $file->copy($filePath, \str_replace('component.php', date('dmyHis').'.php', $filePath)); |
|
| 133 | 133 | |
| 134 | 134 | $this->copyStubToLocation($file, $filePath, $stub); |
| 135 | 135 | |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | 'middleware' => ['web'] |
| 51 | 51 | ]; |
| 52 | 52 | |
| 53 | - $components->each(function ($component, $controller) use ($options) { |
|
| 54 | - collect($component)->each(function ($attributes, $function) use ($controller, $options) { |
|
| 53 | + $components->each(function($component, $controller) use ($options) { |
|
| 54 | + collect($component)->each(function($attributes, $function) use ($controller, $options) { |
|
| 55 | 55 | $options = Arr::set($options, 'prefix', $controller); |
| 56 | 56 | |
| 57 | 57 | if (Arr::get($attributes, 'auth', false)) { |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $options = Arr::set($options, 'middleware', array_merge(Arr::wrap($middleware), ['auth'])); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $this->router->group($options, function (Router $router) use ($controller, $function, $attributes) { |
|
| 64 | - collect($this->componentMethods)->each(function ($type) use ($router, $controller, $function, $attributes) { |
|
| 63 | + $this->router->group($options, function(Router $router) use ($controller, $function, $attributes) { |
|
| 64 | + collect($this->componentMethods)->each(function($type) use ($router, $controller, $function, $attributes) { |
|
| 65 | 65 | $router->addRoute( |
| 66 | 66 | Str::upper($type), |
| 67 | 67 | $this->pathConvention($type, $function, $attributes), |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | 'middleware' => ['auth:api'] |
| 91 | 91 | ]; |
| 92 | 92 | |
| 93 | - $this->router->group($options, function (Router $router) use ($apis) { |
|
| 94 | - $apis->each(function ($routes, $method) use ($router) { |
|
| 93 | + $this->router->group($options, function(Router $router) use ($apis) { |
|
| 94 | + $apis->each(function($routes, $method) use ($router) { |
|
| 95 | 95 | if (!empty($routes)) { |
| 96 | 96 | list($path, $controller, $named) = Arr::first($routes); |
| 97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $path, |
| 101 | 101 | Str::ucfirst($controller) |
| 102 | 102 | )->name( |
| 103 | - 'api.' . $named |
|
| 103 | + 'api.'.$named |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | }); |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | if (!\is_array($keymap) || empty($keymap)) { |
| 25 | 25 | return $function; |
| 26 | 26 | } else { |
| 27 | - $keymap = collect($keymap)->map(function ($id) { |
|
| 28 | - return '{' . $id . '}'; |
|
| 27 | + $keymap = collect($keymap)->map(function($id) { |
|
| 28 | + return '{'.$id.'}'; |
|
| 29 | 29 | })->implode('/'); |
| 30 | 30 | |
| 31 | - return $function . '/' . $keymap; |
|
| 31 | + return $function.'/'.$keymap; |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | protected function classConvention(string $type, string $controller, string $function): string |
| 80 | 80 | { |
| 81 | - return Str::ucfirst($controller) . 'Controller@' . Str::camel(Str::lower($type) . '_' . $function); |
|
| 81 | + return Str::ucfirst($controller).'Controller@'.Str::camel(Str::lower($type).'_'.$function); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $named = Arr::get($attributes, 'named', null); |
| 97 | 97 | |
| 98 | 98 | if ($named === '' || $named === null) { |
| 99 | - $named = Str::lower($controller . '.' . $type . '.' . $function); |
|
| 99 | + $named = Str::lower($controller.'.'.$type.'.'.$function); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | return Str::lower($named); |