-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34313e6
commit 5c144ca
Showing
3 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
/** | ||
* PHP version 8 | ||
* | ||
* @category Library | ||
* @package Commands | ||
* @author Made Mas Adi Winata <m45adiwinata@gmail.com> | ||
* @license https://mit-license.org/ MIT License | ||
* @version GIT: 0.0.9 | ||
* @link https://github.com/spotlibs | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spotlibs\PhpLib\Commands; | ||
|
||
use Illuminate\Console\GeneratorCommand; | ||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
/** | ||
* ServiceMakeCommand | ||
* | ||
* Custom command | ||
* | ||
* @category Console | ||
* @package Commands | ||
* @author Made Mas Adi Winata <m45adiwinata@gmail.com> | ||
* @license https://mit-license.org/ MIT License | ||
* @link https://github.com/ | ||
*/ | ||
class ServiceMakeCommand extends GeneratorCommand | ||
{ | ||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'make:service'; | ||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Create a new service for model class'; | ||
/** | ||
* The type of class being generated. | ||
* | ||
* @var string | ||
*/ | ||
protected $type = 'Service'; | ||
/** | ||
* Get the destination class path. | ||
* | ||
* @param string $name name of the type | ||
* | ||
* @return string | ||
*/ | ||
protected function getPath($name) | ||
{ | ||
return parent::getPath($name . 'Service'); | ||
} | ||
/** | ||
* Get the stub file for the generator. | ||
* | ||
* @return string | ||
*/ | ||
protected function getStub() | ||
{ | ||
if ($this->option('resource')) { | ||
return __DIR__ . '/stubs/service.stub'; | ||
} | ||
return __DIR__ . '/stubs/service.plain.stub'; | ||
} | ||
/** | ||
* Get the default namespace for the class. | ||
* | ||
* @param string $rootNamespace root namespace (generally App) | ||
* | ||
* @return string | ||
*/ | ||
protected function getDefaultNamespace($rootNamespace) | ||
{ | ||
return $rootNamespace . '\Services'; | ||
} | ||
/** | ||
* Get the console command options. | ||
* | ||
* @return array | ||
*/ | ||
protected function getOptions() | ||
{ | ||
return [ | ||
['resource', null, InputOption::VALUE_NONE, 'Generate a resource service class.'], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* PHP version 8.0.30 | ||
* | ||
* @category Application | ||
* @package Services | ||
* @author | ||
* @license https://mit-license.org/ MIT License | ||
* @version GIT: 0.0.1 | ||
* @link https://github.com/ | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Services; | ||
|
||
use App\Library\RestClient; | ||
use Spotlibs\PhpLib\Exceptions\StdException; | ||
use Spotlibs\PhpLib\Exceptions\ThirdPartyServiceException; | ||
|
||
/** | ||
* DummyClassService | ||
* | ||
* Call to surrounding microservices | ||
* | ||
* @category Surrounding | ||
* @package App\Services | ||
* @author | ||
* @license https://mit-license.org/ MIT License | ||
* @link https://github.com/ | ||
*/ | ||
class DummyClassService | ||
{ | ||
private RestClient $rest_client; | ||
public function __construct(RestClient $restClient) | ||
{ | ||
$this->rest_client = $restClient; | ||
} | ||
} |