@@ -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 | |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | if (!\is_array($keymap) || empty($keymap)) { |
| 26 | 26 | return $function; |
| 27 | 27 | } else { |
| 28 | - $keymap = collect($keymap)->map(function ($id, $key) use ($type) { |
|
| 28 | + $keymap = collect($keymap)->map(function($id, $key) use ($type) { |
|
| 29 | 29 | if (!is_int($key) && strtolower($key) === strtolower($type)) { |
| 30 | - return '{' . $id . '}'; |
|
| 30 | + return '{'.$id.'}'; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | return null; |
| 34 | 34 | })->implode('/'); |
| 35 | 35 | |
| 36 | - return $function . '/' . $keymap; |
|
| 36 | + return $function.'/'.$keymap; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function classConvention(string $type, string $controller, string $function): string |
| 85 | 85 | { |
| 86 | - return Str::ucfirst($controller) . 'Controller@' . Str::camel(Str::lower($type) . '_' . $function); |
|
| 86 | + return Str::ucfirst($controller).'Controller@'.Str::camel(Str::lower($type).'_'.$function); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | $named = Arr::get($attributes, 'named', null); |
| 102 | 102 | |
| 103 | 103 | if ($named === '' || $named === null) { |
| 104 | - $named = Str::lower($controller . '.' . $function); |
|
| 104 | + $named = Str::lower($controller.'.'.$function); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (\is_string($named)) { |
| 108 | - return Str::lower($type . '.' . $named); |
|
| 108 | + return Str::lower($type.'.'.$named); |
|
| 109 | 109 | } |
| 110 | 110 | $type = Str::lower($type); |
| 111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | if (collect($names)->has($type)) { |
| 115 | 115 | return Str::lower(collect($names)->get($type, \null)); |
| 116 | 116 | } else { |
| 117 | - return Str::lower($type . '.' . $controller . '.' . $function); |
|
| 117 | + return Str::lower($type.'.'.$controller.'.'.$function); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -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)) { |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $only = Arr::get($attributes, 'only', collect($this->componentMethods)->toArray()); |
| 64 | 64 | |
| 65 | - $componentMethods = collect($this->componentMethods)->filter(function ($item) use ($only) { |
|
| 65 | + $componentMethods = collect($this->componentMethods)->filter(function($item) use ($only) { |
|
| 66 | 66 | return \in_array($item, \array_flip(\array_change_key_case(\array_flip($only), \CASE_UPPER))); |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | - $this->router->group($options, function (Router $router) use ($componentMethods, $controller, $function, $attributes) { |
|
| 70 | - $componentMethods->each(function ($type) use ($router, $controller, $function, $attributes) { |
|
| 69 | + $this->router->group($options, function(Router $router) use ($componentMethods, $controller, $function, $attributes) { |
|
| 70 | + $componentMethods->each(function($type) use ($router, $controller, $function, $attributes) { |
|
| 71 | 71 | $router->addRoute( |
| 72 | 72 | Str::upper($type), |
| 73 | 73 | $this->pathConvention($type, $function, $attributes), |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $function = 'default'; |
| 101 | 101 | $attributes = []; |
| 102 | 102 | |
| 103 | - $this->router->group($options, function (Router $router) use ($type, $controller, $function, $attributes) { |
|
| 103 | + $this->router->group($options, function(Router $router) use ($type, $controller, $function, $attributes) { |
|
| 104 | 104 | $router->addRoute( |
| 105 | 105 | Str::upper($type), |
| 106 | 106 | '/', |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | 'middleware' => ['auth:api'] |
| 127 | 127 | ]; |
| 128 | 128 | |
| 129 | - $this->router->group($options, function (Router $router) use ($apis) { |
|
| 130 | - $apis->each(function ($routes, $method) use ($router) { |
|
| 129 | + $this->router->group($options, function(Router $router) use ($apis) { |
|
| 130 | + $apis->each(function($routes, $method) use ($router) { |
|
| 131 | 131 | if (!empty($routes)) { |
| 132 | 132 | list($path, $controller, $named) = Arr::first($routes); |
| 133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $path, |
| 137 | 137 | Str::ucfirst($controller) |
| 138 | 138 | )->name( |
| 139 | - 'api.' . $named |
|
| 139 | + 'api.'.$named |
|
| 140 | 140 | ); |
| 141 | 141 | } |
| 142 | 142 | }); |