Skip to content

Commit 33ba024

Browse files
committed
Merge branch 'development'
2 parents 4c20c3c + 78a34bb commit 33ba024

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/Commands/MakeRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function createRepository(string $className, $isDefault = true)
119119
$repositoryPath,
120120
__DIR__ . "/stubs/$stubName"
121121
);
122-
$this->line("<info>Created $className repository:</info> " . $repositoryName);
122+
$this->line("<info>Created $className repository implement:</info> " . $repositoryName);
123123

124124
return $repositoryNamespace . "\\" . $className;
125125
}

src/Commands/MakeService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function createService(string $className)
7373
$this->getServicePath($className, $nameOfService),
7474
$stubPath
7575
);
76-
$this->line("<info>Created service:</info> {$serviceName}");
76+
$this->line("<info>Created $className service implement:</info> {$serviceName}");
7777
}
7878

7979
/**
@@ -103,7 +103,7 @@ public function createServiceInterface(string $className)
103103
$this->getServiceInterfacePath($className,$serviceName),
104104
__DIR__ . "/stubs/service-interface.stub"
105105
);
106-
$this->line("<info>Created interface of service:</info> {$serviceName}");
106+
$this->line("<info>Created $className service interface:</info> {$serviceName}");
107107
}
108108

109109
/**

src/RepositoryServiceProvider.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ class RepositoryServiceProvider extends ServiceProvider
2626
*/
2727
public function register()
2828
{
29-
// check ensure main folder services
30-
$this->app->make(Filesystem::class)->ensureDirectoryExists(config("easy-repository.service_directory"));
31-
// check ensure main folder repository
32-
$this->app->make(Filesystem::class)->ensureDirectoryExists(config("easy-repository.repository_directory"));
33-
3429
$this->files = $this->app->make(Filesystem::class);
3530
if ($this->isConfigPublished()) {
3631
$this->bindAllRepositories();
@@ -125,16 +120,20 @@ public function getRepository()
125120
*/
126121
private function getRepositoryPath()
127122
{
128-
$dirs = File::directories($this->app->basePath() .
129-
"/" . config("easy-repository.repository_directory"));
130123
$folders = [];
124+
if(file_exists($this->app->basePath() . "/" . config("easy-repository.repository_directory"))) {
125+
$dirs = File::directories($this->app->basePath() .
126+
"/" . config("easy-repository.repository_directory"));
127+
foreach ($dirs as $dir) {
128+
$arr = explode("/", $dir);
131129

132-
foreach ($dirs as $dir) {
133-
$arr = explode("/", $dir);
130+
$folders[] = end($arr);
131+
}
132+
} else {
134133

135-
$folders[] = end($arr);
136134
}
137135

136+
138137
return $folders;
139138
}
140139

@@ -195,13 +194,17 @@ private function getRepositoryFiles()
195194
private function getServicePath() {
196195
$root = $this->app->basePath() .
197196
"/" . config("easy-repository.service_directory");
197+
$servicePath = [];
198198

199-
$path = Search::file($root, ["php"]);
199+
if(file_exists($root)) {
200+
$path = Search::file($root, ["php"]);
200201

201-
$servicePath = [];
202-
foreach ($path as $file) {
203-
$servicePath[] = str_replace("Services/","",strstr($file->getPath(), "Services"));
202+
203+
foreach ($path as $file) {
204+
$servicePath[] = str_replace("Services/","",strstr($file->getPath(), "Services"));
205+
}
204206
}
207+
205208
return array_unique($servicePath);
206209
}
207210

0 commit comments

Comments
 (0)