@@ -43,21 +43,20 @@ public function handle()
4343 */
4444 public function createService (string $ className )
4545 {
46- $ nameOfService = $ this ->getServiceName ($ className );
47- $ serviceName = $ nameOfService . config ("easy-repository.service_suffix " );
46+ $ serviceName = $ className . config ("easy-repository.service_suffix " );
4847
4948 $ namespace = $ this ->getNameSpace ($ className );
5049 $ stubProperties = [
5150 "{namespace} " => $ namespace ,
5251 "{serviceName} " => $ serviceName ,
53- "{serviceInterface} " => $ nameOfService . config ("easy-repository.service_interface_suffix " ),
54- "{repositoryInterfaceName} " => $ this ->getRepositoryInterfaceName ($ nameOfService ),
55- "{repositoryInterfaceNamespace} " => $ this ->getRepositoryInterfaceNamespace ($ nameOfService ),
52+ "{serviceInterface} " => $ className . config ("easy-repository.service_interface_suffix " ),
53+ "{repositoryInterfaceName} " => $ this ->getRepositoryInterfaceName ($ className ),
54+ "{repositoryInterfaceNamespace} " => $ this ->getRepositoryInterfaceNamespace ($ className ),
5655 ];
5756 // check file exist
58- $ filePath = $ this ->getServicePath ($ className, $ nameOfService );
57+ $ filePath = $ this ->getServicePath ($ className );
5958 if (file_exists ($ filePath )) {
60- $ this ->line ( " <warning> file $ className service already exist:</warning> {$ serviceName }" );
59+ $ this ->error ( " file $ className service already exist: {$ serviceName }" );
6160 return ;
6261 }
6362
@@ -96,7 +95,7 @@ public function createServiceInterface(string $className)
9695 // check folder exist
9796 $ interfacePath = $ this ->getServiceInterfacePath ($ className ,$ serviceName );
9897 if (file_exists ($ interfacePath )) {
99- $ this ->line ( " <warning> file $ className service interface already exist:</warning> {$ serviceName }" );
98+ $ this ->error ( " file $ className service interface already exist: {$ serviceName }" );
10099 return ;
101100 }
102101 // create file
@@ -105,6 +104,7 @@ public function createServiceInterface(string $className)
105104 $ interfacePath ,
106105 __DIR__ . "/stubs/service-interface.stub "
107106 );
107+ $ this ->info ("Service generated successfully " );
108108 $ this ->line ("<info>Created $ className service interface:</info> {$ serviceName }" );
109109 }
110110
@@ -113,11 +113,11 @@ public function createServiceInterface(string $className)
113113 *
114114 * @return string
115115 */
116- private function getServicePath ($ className, $ servicename )
116+ private function getServicePath ($ className )
117117 {
118118 return $ this ->appPath () . "/ " .
119119 config ("easy-repository.service_directory " ) .
120- "/ $ className " . "/ $ servicename " . config ("easy-repository.service_suffix " ) .".php " ;
120+ "/ $ className " . "/ $ className " . config ("easy-repository.service_suffix " ) .".php " ;
121121 }
122122
123123 /**
0 commit comments