mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
The latest images incorporate all changes previously added by the dockerfiles. The arm image however is still missing/unreliable from the registry and must be built independently.
113 lines
2.6 KiB
PHP
113 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace Nwidart\Modules\Commands;
|
|
|
|
use Illuminate\Support\Str;
|
|
use Nwidart\Modules\Support\Config\GenerateConfigReader;
|
|
use Nwidart\Modules\Support\Stub;
|
|
use Nwidart\Modules\Traits\ModuleCommandTrait;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
|
|
class JobMakeCommand extends GeneratorCommand
|
|
{
|
|
use ModuleCommandTrait;
|
|
|
|
/**
|
|
* The console command name.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $name = 'module:make-job';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Create a new job class for the specified module';
|
|
|
|
protected $argumentName = 'name';
|
|
|
|
public function getDefaultNamespace(): string
|
|
{
|
|
$module = $this->laravel['modules'];
|
|
|
|
return $module->config('paths.generator.jobs.namespace') ?: $module->config('paths.generator.jobs.path', 'Jobs');
|
|
}
|
|
|
|
/**
|
|
* Get the console command arguments.
|
|
*
|
|
* @return array
|
|
*/
|
|
protected function getArguments()
|
|
{
|
|
return [
|
|
['name', InputArgument::REQUIRED, 'The name of the job.'],
|
|
['module', InputArgument::OPTIONAL, 'The name of module will be used.'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the console command options.
|
|
*
|
|
* @return array
|
|
*/
|
|
protected function getOptions()
|
|
{
|
|
return [
|
|
['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get template contents.
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function getTemplateContents()
|
|
{
|
|
$module = $this->laravel['modules']->findOrFail($this->getModuleName());
|
|
|
|
return (new Stub($this->getStubName(), [
|
|
'NAMESPACE' => $this->getClassNamespace($module),
|
|
'CLASS' => $this->getClass(),
|
|
]))->render();
|
|
}
|
|
|
|
/**
|
|
* Get the destination file path.
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function getDestinationFilePath()
|
|
{
|
|
$path = $this->laravel['modules']->getModulePath($this->getModuleName());
|
|
|
|
$jobPath = GenerateConfigReader::read('jobs');
|
|
|
|
return $path . $jobPath->getPath() . '/' . $this->getFileName() . '.php';
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
private function getFileName()
|
|
{
|
|
return Str::studly($this->argument('name'));
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
protected function getStubName(): string
|
|
{
|
|
if ($this->option('sync')) {
|
|
return '/job.stub';
|
|
}
|
|
|
|
return '/job-queued.stub';
|
|
}
|
|
}
|