-
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
Showing
17 changed files
with
289 additions
and
255 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,14 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__); | ||
|
||
$config = new PhpCsFixer\Config(); | ||
$config | ||
->setRules([ | ||
"@PSR12" => true | ||
]) | ||
->setFinder($finder); | ||
|
||
return $config; | ||
?> |
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
<?php | ||
namespace AllModules; | ||
|
||
use Suphle\Modules\ModuleHandlerIdentifier; | ||
namespace AllModules; | ||
|
||
use Suphle\Hydration\Container; | ||
use Suphle\Modules\ModuleHandlerIdentifier; | ||
|
||
class PublishedModules extends ModuleHandlerIdentifier { | ||
|
||
public function getModules ():array { | ||
use Suphle\Hydration\Container; | ||
|
||
return []; | ||
} | ||
} | ||
?> | ||
class PublishedModules extends ModuleHandlerIdentifier | ||
{ | ||
public function getModules(): array | ||
{ | ||
|
||
return []; | ||
} | ||
} |
19 changes: 10 additions & 9 deletions
19
ModuleTemplate/AllModules/_module_name/Config/RouterMock.php
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
<?php | ||
namespace AllModules\_module_name\Config; | ||
|
||
use Suphle\Config\Router; | ||
namespace AllModules\_module_name\Config; | ||
|
||
use AllModules\_module_name\Routes\BrowserCollection; | ||
use Suphle\Config\Router; | ||
|
||
class RouterMock extends Router { | ||
use AllModules\_module_name\Routes\BrowserCollection; | ||
|
||
public function browserEntryRoute ():?string { | ||
class RouterMock extends Router | ||
{ | ||
public function browserEntryRoute(): ?string | ||
{ | ||
|
||
return BrowserCollection::class; | ||
} | ||
} | ||
?> | ||
return BrowserCollection::class; | ||
} | ||
} |
17 changes: 9 additions & 8 deletions
17
ModuleTemplate/AllModules/_module_name/Coordinators/BaseCoordinator.php
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
<?php | ||
namespace AllModules\_module_name\Coordinators; | ||
|
||
use Suphle\Services\ServiceCoordinator; | ||
namespace AllModules\_module_name\Coordinators; | ||
|
||
class BaseCoordinator extends ServiceCoordinator { | ||
use Suphle\Services\ServiceCoordinator; | ||
|
||
public function handleHello ():array { | ||
class BaseCoordinator extends ServiceCoordinator | ||
{ | ||
public function handleHello(): array | ||
{ | ||
|
||
return ["message" => "World"]; | ||
} | ||
} | ||
?> | ||
return ["message" => "World"]; | ||
} | ||
} |
24 changes: 13 additions & 11 deletions
24
ModuleTemplate/AllModules/_module_name/Markup/components/AppLayout.php
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 |
---|---|---|
@@ -1,18 +1,20 @@ | ||
<?php | ||
namespace AllModules\_module_name\Markup\Components; | ||
|
||
use Illuminate\View\Component; | ||
namespace AllModules\_module_name\Markup\Components; | ||
|
||
class AppLayouts extends Component { | ||
use Illuminate\View\Component; | ||
|
||
public function __construct ($pageTitle, $scripts) { | ||
class AppLayouts extends Component | ||
{ | ||
public function __construct($pageTitle, $scripts) | ||
{ | ||
|
||
// | ||
} | ||
// | ||
} | ||
|
||
public function render () { | ||
public function render() | ||
{ | ||
|
||
return view("layouts.app"); | ||
} | ||
} | ||
?> | ||
return view("layouts.app"); | ||
} | ||
} |
44 changes: 23 additions & 21 deletions
44
ModuleTemplate/AllModules/_module_name/Meta/CustomInterfaceCollection.php
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 |
---|---|---|
@@ -1,34 +1,36 @@ | ||
<?php | ||
namespace AllModules\_module_name\Meta; | ||
|
||
use Suphle\Hydration\Structures\BaseInterfaceCollection; | ||
namespace AllModules\_module_name\Meta; | ||
|
||
use Suphle\Contracts\{Config\Router, Auth\UserContract}; | ||
use Suphle\Hydration\Structures\BaseInterfaceCollection; | ||
|
||
use AllModules\_module_name\Config\RouterMock; | ||
use Suphle\Contracts\{Config\Router, Auth\UserContract}; | ||
|
||
use AppModels\User as EloquentUser; // hard-coded cuz different processes control module cloning and component ejection | ||
use AllModules\_module_name\Config\RouterMock; | ||
|
||
use ModuleInteractions\_module_name; | ||
use AppModels\User as EloquentUser; // hard-coded cuz different processes control module cloning and component ejection | ||
|
||
class CustomInterfaceCollection extends BaseInterfaceCollection { | ||
use ModuleInteractions\_module_name; | ||
|
||
public function getConfigs ():array { | ||
|
||
return array_merge(parent::getConfigs(), [ | ||
class CustomInterfaceCollection extends BaseInterfaceCollection | ||
{ | ||
public function getConfigs(): array | ||
{ | ||
|
||
Router::class => RouterMock::class | ||
]); | ||
} | ||
return array_merge(parent::getConfigs(), [ | ||
|
||
public function simpleBinds ():array { | ||
Router::class => RouterMock::class | ||
]); | ||
} | ||
|
||
return array_merge(parent::simpleBinds(), [ | ||
public function simpleBinds(): array | ||
{ | ||
|
||
_module_name::class => ModuleApi::class, | ||
return array_merge(parent::simpleBinds(), [ | ||
|
||
UserContract::class => EloquentUser::class | ||
]); | ||
} | ||
} | ||
?> | ||
_module_name::class => ModuleApi::class, | ||
|
||
UserContract::class => EloquentUser::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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<?php | ||
namespace AllModules\_module_name\Meta; | ||
|
||
use ModuleInteractions\_module_name; | ||
namespace AllModules\_module_name\Meta; | ||
|
||
class ModuleApi implements _module_name { | ||
use ModuleInteractions\_module_name; | ||
|
||
// | ||
} | ||
?> | ||
class ModuleApi implements _module_name | ||
{ | ||
// | ||
} |
67 changes: 35 additions & 32 deletions
67
ModuleTemplate/AllModules/_module_name/Meta/_module_nameDescriptor.php
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 |
---|---|---|
@@ -1,49 +1,52 @@ | ||
<?php | ||
namespace AllModules\_module_name\Meta; | ||
|
||
use Suphle\Modules\ModuleDescriptor; | ||
namespace AllModules\_module_name\Meta; | ||
|
||
use Suphle\Contracts\Config\ModuleFiles; | ||
use Suphle\Modules\ModuleDescriptor; | ||
|
||
use Suphle\Config\AscendingHierarchy; | ||
use Suphle\Contracts\Config\ModuleFiles; | ||
|
||
use Suphle\File\FileSystemReader; | ||
use Suphle\Config\AscendingHierarchy; | ||
|
||
use ModuleInteractions\_module_name; | ||
use Suphle\File\FileSystemReader; | ||
|
||
class _module_nameDescriptor extends ModuleDescriptor { | ||
use ModuleInteractions\_module_name; | ||
|
||
public function interfaceCollection ():string { | ||
class _module_nameDescriptor extends ModuleDescriptor | ||
{ | ||
public function interfaceCollection(): string | ||
{ | ||
|
||
return CustomInterfaceCollection::class; | ||
} | ||
return CustomInterfaceCollection::class; | ||
} | ||
|
||
public function exportsImplements():string { | ||
public function exportsImplements(): string | ||
{ | ||
|
||
return _module_name::class; | ||
} | ||
return _module_name::class; | ||
} | ||
|
||
public function globalConcretes ():array { | ||
public function globalConcretes(): array | ||
{ | ||
|
||
return array_merge(parent::globalConcretes(), [ | ||
return array_merge(parent::globalConcretes(), [ | ||
|
||
ModuleFiles::class => new AscendingHierarchy( | ||
|
||
__DIR__, __NAMESPACE__, | ||
ModuleFiles::class => new AscendingHierarchy( | ||
__DIR__, | ||
__NAMESPACE__, | ||
$this->container->getClass(FileSystemReader::class) | ||
) | ||
]); | ||
} | ||
|
||
$this->container->getClass(FileSystemReader::class) | ||
) | ||
]); | ||
} | ||
/** | ||
* Remove this method after installation completes. Without components, the illuminate component won't boot and interrupt module creation | ||
*/ | ||
protected function registerConcreteBindings(): void | ||
{ | ||
|
||
/** | ||
* Remove this method after installation completes. Without components, the illuminate component won't boot and interrupt module creation | ||
*/ | ||
protected function registerConcreteBindings ():void { | ||
$bindings = $this->globalConcretes(); | ||
|
||
$bindings = $this->globalConcretes(); | ||
|
||
$this->container->whenTypeAny()->needsAny($bindings); | ||
} | ||
} | ||
?> | ||
$this->container->whenTypeAny()->needsAny($bindings); | ||
} | ||
} |
30 changes: 16 additions & 14 deletions
30
ModuleTemplate/AllModules/_module_name/Routes/BrowserCollection.php
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
<?php | ||
namespace AllModules\_module_name\Routes; | ||
|
||
use Suphle\Routing\{BaseCollection, Decorators\HandlingCoordinator}; | ||
namespace AllModules\_module_name\Routes; | ||
|
||
use Suphle\Response\Format\Json; | ||
use Suphle\Routing\{BaseCollection, Decorators\HandlingCoordinator}; | ||
|
||
use AllModules\_module_name\Coordinators\BaseCoordinator; | ||
use Suphle\Response\Format\Json; | ||
|
||
#[HandlingCoordinator(BaseCoordinator::class)] | ||
class BrowserCollection extends BaseCollection { | ||
use AllModules\_module_name\Coordinators\BaseCoordinator; | ||
|
||
public function _prefixCurrent ():string { | ||
#[HandlingCoordinator(BaseCoordinator::class)] | ||
class BrowserCollection extends BaseCollection | ||
{ | ||
public function _prefixCurrent(): string | ||
{ | ||
|
||
return strtoupper("_module_name"); // assumes no strings/hyphens/underscore is expected | ||
} | ||
return strtoupper("_module_name"); // assumes no strings/hyphens/underscore is expected | ||
} | ||
|
||
public function HELLO () { | ||
public function HELLO() | ||
{ | ||
|
||
$this->_get(new Json("handleHello")); | ||
} | ||
} | ||
?> | ||
$this->_get(new Json("handleHello")); | ||
} | ||
} |
34 changes: 18 additions & 16 deletions
34
ModuleTemplate/AllModules/_module_name/Tests/ConfirmInstallTest.php
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 |
---|---|---|
@@ -1,27 +1,29 @@ | ||
<?php | ||
namespace AllModules\_module_name\Tests; | ||
|
||
use Suphle\Hydration\Container; | ||
namespace AllModules\_module_name\Tests; | ||
|
||
use Suphle\Testing\TestTypes\ModuleLevelTest; | ||
use Suphle\Hydration\Container; | ||
|
||
use AllModules\_module_name\Meta\_module_nameDescriptor; | ||
use Suphle\Testing\TestTypes\ModuleLevelTest; | ||
|
||
class ConfirmInstallTest extends ModuleLevelTest { | ||
use AllModules\_module_name\Meta\_module_nameDescriptor; | ||
|
||
protected function getModules ():array { | ||
class ConfirmInstallTest extends ModuleLevelTest | ||
{ | ||
protected function getModules(): array | ||
{ | ||
|
||
return [new _module_nameDescriptor(new Container)]; | ||
} | ||
return [new _module_nameDescriptor(new Container())]; | ||
} | ||
|
||
public function test_initial_path_is_accessible () { | ||
public function test_initial_path_is_accessible() | ||
{ | ||
|
||
$prefix = strtolower("_module_name"); | ||
$prefix = strtolower("_module_name"); | ||
|
||
$this->get("/$prefix/hello") // when | ||
$this->get("/$prefix/hello") // when | ||
|
||
// then | ||
->assertOk()->assertJson(["message" => "World"]); | ||
} | ||
} | ||
?> | ||
// then | ||
->assertOk()->assertJson(["message" => "World"]); | ||
} | ||
} |
Oops, something went wrong.