@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('get_artomator_template_file_path')) { |
|
| 3 | +if ( ! function_exists('get_artomator_template_file_path')) { |
|
| 4 | 4 | /** |
| 5 | 5 | * get path for template file. |
| 6 | 6 | * |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @return string |
| 11 | 11 | */ |
| 12 | - function get_artomator_template_file_path($templateName, $templateType) |
|
| 12 | + function get_artomator_template_file_path ($templateName, $templateType) |
|
| 13 | 13 | { |
| 14 | 14 | $templateName = str_replace('.', '/', $templateName); |
| 15 | 15 | |
@@ -18,21 +18,21 @@ discard block |
||
| 18 | 18 | resource_path('infyom/infyom-generator-templates/') |
| 19 | 19 | ); |
| 20 | 20 | |
| 21 | - $path = $templatesPath.$templateName.'.stub'; |
|
| 21 | + $path = $templatesPath . $templateName . '.stub'; |
|
| 22 | 22 | |
| 23 | 23 | if (file_exists($path)) { |
| 24 | 24 | return $path; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if (file_exists(base_path('vendor/pwweb/'.$templateType.'/templates/'.$templateName.'.stub'))) { |
|
| 28 | - return base_path('vendor/pwweb/'.$templateType.'/templates/'.$templateName.'.stub'); |
|
| 27 | + if (file_exists(base_path('vendor/pwweb/' . $templateType . '/templates/' . $templateName . '.stub'))) { |
|
| 28 | + return base_path('vendor/pwweb/' . $templateType . '/templates/' . $templateName . '.stub'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - return base_path('vendor/infyomlabs/'.$templateType.'/templates/'.$templateName.'.stub'); |
|
| 31 | + return base_path('vendor/infyomlabs/' . $templateType . '/templates/' . $templateName . '.stub'); |
|
| 32 | 32 | } |
| 33 | 33 | }//end if |
| 34 | 34 | |
| 35 | -if (! function_exists('get_artomator_template')) { |
|
| 35 | +if ( ! function_exists('get_artomator_template')) { |
|
| 36 | 36 | /** |
| 37 | 37 | * get template contents. |
| 38 | 38 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return string |
| 43 | 43 | */ |
| 44 | - function get_artomator_template($templateName, $templateType = 'artomator') |
|
| 44 | + function get_artomator_template ($templateName, $templateType = 'artomator') |
|
| 45 | 45 | { |
| 46 | 46 | $path = get_artomator_template_file_path($templateName, $templateType); |
| 47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | }//end if |
| 51 | 51 | |
| 52 | -if (! function_exists('license_authors')) { |
|
| 52 | +if ( ! function_exists('license_authors')) { |
|
| 53 | 53 | /** |
| 54 | 54 | * format authors for codeblock. |
| 55 | 55 | * |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
| 60 | - function license_authors($authors) |
|
| 60 | + function license_authors ($authors) |
|
| 61 | 61 | { |
| 62 | 62 | if (true === is_array($authors)) { |
| 63 | 63 | return implode("\n * @author ", $authors); |
@@ -10,24 +10,24 @@ |
||
| 10 | 10 | |
| 11 | 11 | class BaseCommand extends Base |
| 12 | 12 | { |
| 13 | - public function generateGraphQLItems() |
|
| 13 | + public function generateGraphQLItems () |
|
| 14 | 14 | { |
| 15 | - if (! $this->isSkip('mutations') and ! $this->isSkip('graphql_mutations')) { |
|
| 15 | + if ( ! $this->isSkip('mutations') and ! $this->isSkip('graphql_mutations')) { |
|
| 16 | 16 | $mutationGenerator = new GraphQLMutationGenerator($this->commandData); |
| 17 | 17 | $mutationGenerator->generate(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if (! $this->isSkip('queries') and ! $this->isSkip('graphql_query')) { |
|
| 20 | + if ( ! $this->isSkip('queries') and ! $this->isSkip('graphql_query')) { |
|
| 21 | 21 | $queryGenerator = new GraphQLQueryGenerator($this->commandData); |
| 22 | 22 | $queryGenerator->generate(); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if (! $this->isSkip('types') and ! $this->isSkip('graphql_types')) { |
|
| 25 | + if ( ! $this->isSkip('types') and ! $this->isSkip('graphql_types')) { |
|
| 26 | 26 | $typeGenerator = new GraphQLTypeGenerator($this->commandData); |
| 27 | 27 | $typeGenerator->generate(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if (! $this->isSkip('subscription') and ! $this->isSkip('graphql_subscription')) { |
|
| 30 | + if ( ! $this->isSkip('subscription') and ! $this->isSkip('graphql_subscription')) { |
|
| 31 | 31 | $subscriptionGenerator = new GraphQLSubscriptionGenerator($this->commandData); |
| 32 | 32 | $subscriptionGenerator->generate(); |
| 33 | 33 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * Execute the command. |
| 27 | 27 | */ |
| 28 | - public function handle() |
|
| 28 | + public function handle () |
|
| 29 | 29 | { |
| 30 | 30 | $this->templatesDir = config( |
| 31 | 31 | 'infyom.laravel_generator.path.templates_dir', |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Publishes templates. |
| 43 | 43 | */ |
| 44 | - public function publishGeneratorTemplates() |
|
| 44 | + public function publishGeneratorTemplates () |
|
| 45 | 45 | { |
| 46 | - $templatesPath = __DIR__.'/../../../../../infyomlabs/laravel-generator/templates'; |
|
| 46 | + $templatesPath = __DIR__ . '/../../../../../infyomlabs/laravel-generator/templates'; |
|
| 47 | 47 | |
| 48 | 48 | $this->publishDirectory($templatesPath, $this->templatesDir, 'infyom-generator-templates'); |
| 49 | 49 | |
| 50 | - $templatesPath = __DIR__.'/../../../templates'; |
|
| 50 | + $templatesPath = __DIR__ . '/../../../templates'; |
|
| 51 | 51 | |
| 52 | 52 | return $this->publishDirectory($templatesPath, $this->templatesDir, 'pwweb-artomator-templates'); |
| 53 | 53 | } |
@@ -55,19 +55,19 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * Publishes scaffold stemplates. |
| 57 | 57 | */ |
| 58 | - public function publishScaffoldTemplates() |
|
| 58 | + public function publishScaffoldTemplates () |
|
| 59 | 59 | { |
| 60 | 60 | $templateType = config('infyom.laravel_generator.templates', 'adminlte-templates'); |
| 61 | 61 | |
| 62 | - $templatesPath = base_path('vendor/infyomlabs/'.$templateType.'/templates/scaffold'); |
|
| 62 | + $templatesPath = base_path('vendor/infyomlabs/' . $templateType . '/templates/scaffold'); |
|
| 63 | 63 | |
| 64 | - return $this->publishDirectory($templatesPath, $this->templatesDir.'scaffold', 'infyom-generator-templates/scaffold', true); |
|
| 64 | + return $this->publishDirectory($templatesPath, $this->templatesDir . 'scaffold', 'infyom-generator-templates/scaffold', true); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Publishes swagger stemplates. |
| 69 | 69 | */ |
| 70 | - public function publishSwaggerTemplates() |
|
| 70 | + public function publishSwaggerTemplates () |
|
| 71 | 71 | { |
| 72 | 72 | $templatesPath = base_path('vendor/infyomlabs/swagger-generator/templates'); |
| 73 | 73 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return array |
| 81 | 81 | */ |
| 82 | - public function getOptions() |
|
| 82 | + public function getOptions () |
|
| 83 | 83 | { |
| 84 | 84 | return []; |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return array |
| 91 | 91 | */ |
| 92 | - protected function getArguments() |
|
| 92 | + protected function getArguments () |
|
| 93 | 93 | { |
| 94 | 94 | return []; |
| 95 | 95 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Create a new command instance. |
| 25 | 25 | */ |
| 26 | - public function __construct() |
|
| 26 | + public function __construct () |
|
| 27 | 27 | { |
| 28 | 28 | parent::__construct(); |
| 29 | 29 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | - public function handle() |
|
| 38 | + public function handle () |
|
| 39 | 39 | { |
| 40 | 40 | parent::handle(); |
| 41 | 41 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return array |
| 55 | 55 | */ |
| 56 | - public function getOptions() |
|
| 56 | + public function getOptions () |
|
| 57 | 57 | { |
| 58 | 58 | return array_merge(parent::getOptions(), []); |
| 59 | 59 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return array |
| 65 | 65 | */ |
| 66 | - protected function getArguments() |
|
| 66 | + protected function getArguments () |
|
| 67 | 67 | { |
| 68 | 68 | return array_merge(parent::getArguments(), []); |
| 69 | 69 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | /** |
| 17 | 17 | * Bootstrap the application services. |
| 18 | 18 | */ |
| 19 | - public function boot() |
|
| 19 | + public function boot () |
|
| 20 | 20 | { |
| 21 | - $configPath = __DIR__.'/../config/artomator.php'; |
|
| 22 | - $configPathInfyom = __DIR__.'/../../../infyomlabs/laravel-generator/config/laravel_generator.php'; |
|
| 21 | + $configPath = __DIR__ . '/../config/artomator.php'; |
|
| 22 | + $configPathInfyom = __DIR__ . '/../../../infyomlabs/laravel-generator/config/laravel_generator.php'; |
|
| 23 | 23 | |
| 24 | 24 | $this->publishes( |
| 25 | 25 | [ |
@@ -35,51 +35,51 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * Register the application services. |
| 37 | 37 | */ |
| 38 | - public function register() |
|
| 38 | + public function register () |
|
| 39 | 39 | { |
| 40 | 40 | $this->app->singleton( |
| 41 | 41 | 'artomator.graphql', |
| 42 | - function ($app) { |
|
| 42 | + function($app) { |
|
| 43 | 43 | return new GraphQLGeneratorCommand(); |
| 44 | 44 | } |
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | $this->app->singleton( |
| 48 | 48 | 'artomator.graphql_scaffold', |
| 49 | - function ($app) { |
|
| 49 | + function($app) { |
|
| 50 | 50 | return new GraphQLScaffoldGeneratorCommand(); |
| 51 | 51 | } |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | $this->app->singleton( |
| 55 | 55 | 'artomator.graphql.query', |
| 56 | - function ($app) { |
|
| 56 | + function($app) { |
|
| 57 | 57 | return new GraphQLQueryGeneratorCommand(); |
| 58 | 58 | } |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | 61 | $this->app->singleton( |
| 62 | 62 | 'artomator.graphql.mutations', |
| 63 | - function ($app) { |
|
| 63 | + function($app) { |
|
| 64 | 64 | return new GraphQLMutationsGeneratorCommand(); |
| 65 | 65 | } |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | $this->app->singleton( |
| 69 | 69 | 'artomator.graphql.type', |
| 70 | - function ($app) { |
|
| 70 | + function($app) { |
|
| 71 | 71 | return new GraphQLTypeGeneratorCommand(); |
| 72 | 72 | } |
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | 75 | $this->app->singleton( |
| 76 | 76 | 'artomator.graphql.subscription', |
| 77 | - function ($app) { |
|
| 77 | + function($app) { |
|
| 78 | 78 | return new GraphQLSubscriptionGeneratorCommand(); |
| 79 | 79 | } |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | - $this->app->singleton('artomator.publish.templates', function ($app) { |
|
| 82 | + $this->app->singleton('artomator.publish.templates', function($app) { |
|
| 83 | 83 | return new PublishTemplateCommand(); |
| 84 | 84 | }); |
| 85 | 85 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * |
| 12 | 12 | * @return string |
| 13 | 13 | */ |
| 14 | - protected static function getFacadeAccessor() |
|
| 14 | + protected static function getFacadeAccessor () |
|
| 15 | 15 | { |
| 16 | 16 | return 'artomator'; |
| 17 | 17 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $templateData; |
| 30 | 30 | |
| 31 | - public function __construct(CommandData $commandData) |
|
| 31 | + public function __construct (CommandData $commandData) |
|
| 32 | 32 | { |
| 33 | 33 | $this->commandData = $commandData; |
| 34 | 34 | $this->filename = $commandData->config->pathGraphQL; |
@@ -38,22 +38,22 @@ discard block |
||
| 38 | 38 | $this->templateData = fill_template($this->generateSchema(), $this->templateData); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function generate() |
|
| 41 | + public function generate () |
|
| 42 | 42 | { |
| 43 | 43 | if (Str::contains($this->fileContents, $this->templateData) === true) { |
| 44 | - $this->commandData->commandObj->info('GraphQL Mutations '.$this->commandData->config->mHumanPlural.' already exist; Skipping'); |
|
| 44 | + $this->commandData->commandObj->info('GraphQL Mutations ' . $this->commandData->config->mHumanPlural . ' already exist; Skipping'); |
|
| 45 | 45 | |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $this->fileContents = preg_replace('/(type Mutation {)(.+?[^}])(})/is', '$1$2'.$this->templateData.'$3', $this->fileContents); |
|
| 49 | + $this->fileContents = preg_replace('/(type Mutation {)(.+?[^}])(})/is', '$1$2' . $this->templateData . '$3', $this->fileContents); |
|
| 50 | 50 | |
| 51 | 51 | file_put_contents($this->filename, $this->fileContents); |
| 52 | 52 | |
| 53 | 53 | $this->commandData->commandComment("\nGraphQL Mutations created"); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function rollback() |
|
| 56 | + public function rollback () |
|
| 57 | 57 | { |
| 58 | 58 | if (Str::contains($this->fileContents, $this->templateData)) { |
| 59 | 59 | file_put_contents($this->path, str_replace($this->templateData, '', $this->fileContents)); |
@@ -61,16 +61,16 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - private function generateSchema() |
|
| 64 | + private function generateSchema () |
|
| 65 | 65 | { |
| 66 | 66 | $schema = []; |
| 67 | 67 | foreach ($this->commandData->fields as $field) { |
| 68 | 68 | if (true === in_array($field->name, ['created_at', 'updated_at', 'id'])) { |
| 69 | 69 | continue; |
| 70 | 70 | } |
| 71 | - $field_type = ucfirst($field->fieldType).(Str::contains($field->validations, 'required') ? '!' : ''); |
|
| 71 | + $field_type = ucfirst($field->fieldType) . (Str::contains($field->validations, 'required') ? '!' : ''); |
|
| 72 | 72 | |
| 73 | - $schema[] = $field->name.': '.$field_type; |
|
| 73 | + $schema[] = $field->name . ': ' . $field_type; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return ['$SCHEMA$' => implode(', ', $schema)]; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $templateData; |
| 30 | 30 | |
| 31 | - public function __construct(CommandData $commandData) |
|
| 31 | + public function __construct (CommandData $commandData) |
|
| 32 | 32 | { |
| 33 | 33 | $this->commandData = $commandData; |
| 34 | 34 | $this->filename = $commandData->config->pathGraphQL; |
@@ -37,22 +37,22 @@ discard block |
||
| 37 | 37 | $this->templateData = fill_template($this->commandData->dynamicVars, $this->templateData); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function generate() |
|
| 40 | + public function generate () |
|
| 41 | 41 | { |
| 42 | 42 | if (Str::contains($this->fileContents, $this->templateData) === true) { |
| 43 | - $this->commandData->commandObj->info('GraphQL Query '.$this->commandData->config->mHumanPlural.' already exists; Skipping'); |
|
| 43 | + $this->commandData->commandObj->info('GraphQL Query ' . $this->commandData->config->mHumanPlural . ' already exists; Skipping'); |
|
| 44 | 44 | |
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->fileContents = preg_replace('/(type Query {)(.+?[^}])(})/is', '$1$2'.$this->templateData.'$3', $this->fileContents); |
|
| 48 | + $this->fileContents = preg_replace('/(type Query {)(.+?[^}])(})/is', '$1$2' . $this->templateData . '$3', $this->fileContents); |
|
| 49 | 49 | |
| 50 | 50 | file_put_contents($this->filename, $this->fileContents); |
| 51 | 51 | |
| 52 | 52 | $this->commandData->commandComment("\nGraphQL Query created"); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function rollback() |
|
| 55 | + public function rollback () |
|
| 56 | 56 | { |
| 57 | 57 | if (Str::contains($this->fileContents, $this->templateData)) { |
| 58 | 58 | file_put_contents($this->path, str_replace($this->templateData, '', $this->fileContents)); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $templateData; |
| 30 | 30 | |
| 31 | - public function __construct(CommandData $commandData) |
|
| 31 | + public function __construct (CommandData $commandData) |
|
| 32 | 32 | { |
| 33 | 33 | $this->commandData = $commandData; |
| 34 | 34 | $this->filename = $commandData->config->pathGraphQL; |
@@ -37,22 +37,22 @@ discard block |
||
| 37 | 37 | $this->templateData = fill_template($this->commandData->dynamicVars, $this->templateData); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function generate() |
|
| 40 | + public function generate () |
|
| 41 | 41 | { |
| 42 | 42 | if (Str::contains($this->fileContents, $this->templateData) === true) { |
| 43 | - $this->commandData->commandObj->info('GraphQL Subscription '.$this->commandData->config->mHumanPlural.' already exists; Skipping'); |
|
| 43 | + $this->commandData->commandObj->info('GraphQL Subscription ' . $this->commandData->config->mHumanPlural . ' already exists; Skipping'); |
|
| 44 | 44 | |
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->fileContents = preg_replace('/(type Subscription {)(.+?[^}])(})/is', '$1$2'.$this->templateData.'$3', $this->fileContents); |
|
| 48 | + $this->fileContents = preg_replace('/(type Subscription {)(.+?[^}])(})/is', '$1$2' . $this->templateData . '$3', $this->fileContents); |
|
| 49 | 49 | |
| 50 | 50 | file_put_contents($this->filename, $this->fileContents); |
| 51 | 51 | |
| 52 | 52 | $this->commandData->commandComment("\nGraphQL Subscription created"); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function rollback() |
|
| 55 | + public function rollback () |
|
| 56 | 56 | { |
| 57 | 57 | if (Str::contains($this->fileContents, $this->templateData)) { |
| 58 | 58 | file_put_contents($this->path, str_replace($this->templateData, '', $this->fileContents)); |