Skip to content

Commit

Permalink
Run project through psr-12
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeri17 committed Apr 25, 2023
1 parent 4d1132c commit 7a30cbe
Show file tree
Hide file tree
Showing 17 changed files with 289 additions and 255 deletions.
14 changes: 14 additions & 0 deletions .php_cs.php
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;
?>
21 changes: 11 additions & 10 deletions AllModules/PublishedModules.php
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 ModuleTemplate/AllModules/_module_name/Config/RouterMock.php
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;
}
}
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"];
}
}
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");
}
}
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
]);
}
}
12 changes: 6 additions & 6 deletions ModuleTemplate/AllModules/_module_name/Meta/ModuleApi.php
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
{
//
}
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 ModuleTemplate/AllModules/_module_name/Routes/BrowserCollection.php
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 ModuleTemplate/AllModules/_module_name/Tests/ConfirmInstallTest.php
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"]);
}
}
Loading

0 comments on commit 7a30cbe

Please sign in to comment.