Skip to content

Commit 0478ccb

Browse files
author
Sergey Surkov
committed
Добавление вендора в базовый неймспейс
1 parent c3ccc3d commit 0478ccb

6 files changed

Lines changed: 34 additions & 13 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"symbiotic/ui_backend": "1.*"
66
},
77
"license": "MIT",
8-
"version": "1.2.0",
8+
"version": "1.2.1",
99
"autoload": {
1010
"psr-4": {
1111
"Symbiotic\\Develop\\": "src/"
@@ -22,7 +22,7 @@
2222
"name": "Develop",
2323
"routing": "\\Symbiotic\\Develop\\Routing",
2424
"controllers_namespace": "\\Symbiotic\\Develop\\Http\\Controllers",
25-
"version": "1.0.0",
25+
"version": "1.2.1",
2626
"providers": [
2727
"\\Symbiotic\\Develop\\Providers\\AppProvider"
2828
],

src/Http/Controllers/Backend/Index.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
use Symbiotic\Apps\ApplicationInterface;
6+
use Symbiotic\Core\CoreInterface;
67
use Symbiotic\Core\Events\CacheClear;
78
use Symbiotic\Core\View\View;
89
use function _DS\event;
@@ -20,9 +21,24 @@ public function index(ApplicationInterface $app)
2021

2122
}
2223

23-
public function cache_clean()
24+
public function cache_clean(CoreInterface $app)
2425
{
2526
event(new CacheClear('all'));
26-
return 'Ложки не существует!';
27+
$path = $app('cache_path');
28+
29+
$files = new \RecursiveIteratorIterator(
30+
new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS),
31+
\RecursiveIteratorIterator::CHILD_FIRST
32+
);
33+
$result = [];
34+
/**
35+
* @var \SplFileInfo $file
36+
*/
37+
foreach ($files as $file) {
38+
$result[] = $file->getRealPath();
39+
40+
}
41+
42+
return $result;
2743
}
2844
}

src/Http/Controllers/Backend/PackagesBuilding/PackagesCreator.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use Symbiotic\Apps\ApplicationInterface;
77
use Symbiotic\Core\CoreInterface;
8+
use Symbiotic\Core\Support\Str;
89
use Symbiotic\Develop\Services\Packages\Builder\PackageCreatorBuilder;
910

1011
use Symbiotic\Http\ServerRequest;
@@ -41,15 +42,22 @@ public function create(ServerRequest $request, CoreInterface $app, PackageCreato
4142
if (!is_dir($packages_path) || !is_writable($packages_path)) {
4243
throw new \Exception('Директория приложений не существует или не доступная для записи [' . $packages_path . ']!');
4344
}
45+
4446
$vendor = $request->getInput('vendor');
4547
$package_name = $request->getInput('package_name');
4648
$name = $request->getInput('name');
49+
4750
$package = $builder->createAppPackage(
4851
$packages_path,
4952
\strtolower($package_name),
5053
$name
5154
);
55+
5256
$package->withVendor($vendor);
57+
58+
if($vendor !== 'symbiotic') {
59+
$package->setBaseNamespace(ucfirst(Str::camel($vendor)).'\\'.ucfirst(Str::camel($package_name)));
60+
}
5361
$package->withPackageName($package_name);
5462

5563
if (!empty($request->getInput('with_demo'))) {

src/Routing.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@ public function backendRoutes(RouterInterface $router)
1717
$router->group([ 'namespace' => 'Backend'], function(RouterInterface $router){
1818
$router->get('/timer/', [
1919
'uses' => 'Monitor@json',
20-
'as' => 'monitor.json',
21-
'secure' => false
20+
'as' => 'monitor.json'
2221
]);
2322
$router->get('/phpinfo/', [
2423
'uses' => 'Monitor@phpinfo',
25-
'as' => 'monitor.phpinfo',
26-
'secure' => false
24+
'as' => 'monitor.phpinfo'
2725
]);
2826
$router->get('/cache/clean/', [
2927
'uses' => 'Index@cache_clean',
30-
'as' => 'cache.clean',
31-
'secure' => false
28+
'as' => 'cache.clean'
3229
]);
3330

34-
3531
$router->group(['prefix' => '/apps', 'as' => 'apps'], function(RouterInterface $router){
3632
$router->get('{app_id}/routes', [
3733
'uses' => 'Apps@routes',

src/Services/Debug/Timer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function end(string $name)
3737
{
3838
if (!isset($this->timers[$name]))
3939
{
40-
throw new \LogicException("Сначала запуститте таймер start('$name')");
40+
$this->timers[$name] = [];
4141
}
4242
if(isset($this->timers[$name]['end'])) {
4343
return $this;

src/Services/Packages/Builder/SymbioticPackageCreator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Symbiotic\Develop\Services\Packages\Builder;
44

5+
use Symbiotic\Core\Support\Str;
56
use function dirname;
67
use function trim;
78
use const _DS\DS;
@@ -315,7 +316,7 @@ protected function getStubClassContent(string $path, array $replaces)
315316
protected function getBaseNamespace(): string
316317
{
317318
if (!$this->base_namespace) {
318-
$this->base_namespace = 'Symbiotic\\Module\\' . \ucfirst(\strtolower($this->packege_id));
319+
$this->base_namespace = 'Symbiotic\\Module\\' . \ucfirst(Str::camel($this->packege_id));
319320
}
320321

321322
return $this->base_namespace;

0 commit comments

Comments
 (0)