Initial Commit
This commit is contained in:
Executable
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace mpba\Modules\Contracts;
|
||||
|
||||
use mpba\Modules\Module;
|
||||
|
||||
interface ActivatorInterface
|
||||
{
|
||||
/**
|
||||
* Enables a module
|
||||
*/
|
||||
public function enable(Module $module): void;
|
||||
|
||||
/**
|
||||
* Disables a module
|
||||
*/
|
||||
public function disable(Module $module): void;
|
||||
|
||||
/**
|
||||
* Determine whether the given status same with a module status.
|
||||
*/
|
||||
public function hasStatus(Module $module, bool $status): bool;
|
||||
|
||||
/**
|
||||
* Set active state for a module.
|
||||
*/
|
||||
public function setActive(Module $module, bool $active): void;
|
||||
|
||||
/**
|
||||
* Sets a module status by its name
|
||||
*/
|
||||
public function setActiveByName(string $name, bool $active): void;
|
||||
|
||||
/**
|
||||
* Deletes a module activation status
|
||||
*/
|
||||
public function delete(Module $module): void;
|
||||
|
||||
/**
|
||||
* Deletes any module activation statuses created by this class.
|
||||
*/
|
||||
public function reset(): void;
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace mpba\Modules\Contracts;
|
||||
|
||||
interface PublisherInterface
|
||||
{
|
||||
/**
|
||||
* Publish something.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function publish();
|
||||
}
|
||||
Executable
+168
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace mpba\Modules\Contracts;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use mpba\Modules\Collection;
|
||||
use mpba\Modules\Exceptions\ModuleNotFoundException;
|
||||
use mpba\Modules\Module;
|
||||
|
||||
interface RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Get all modules.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function all();
|
||||
|
||||
/**
|
||||
* Get cached modules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCached();
|
||||
|
||||
/**
|
||||
* Scan & get all available modules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function scan();
|
||||
|
||||
/**
|
||||
* Get modules as modules collection instance.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function toCollection();
|
||||
|
||||
/**
|
||||
* Get scanned paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getScanPaths();
|
||||
|
||||
/**
|
||||
* Get list of enabled modules.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function allEnabled();
|
||||
|
||||
/**
|
||||
* Get list of disabled modules.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function allDisabled();
|
||||
|
||||
/**
|
||||
* Get count from all modules.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count();
|
||||
|
||||
/**
|
||||
* Get all ordered modules.
|
||||
*
|
||||
* @param string $direction
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOrdered($direction = 'asc');
|
||||
|
||||
/**
|
||||
* Get modules by the given status.
|
||||
*
|
||||
* @param int $status
|
||||
* @return mixed
|
||||
*/
|
||||
public function getByStatus($status);
|
||||
|
||||
/**
|
||||
* Find a specific module.
|
||||
*
|
||||
* @return Module|null
|
||||
*/
|
||||
public function find(string $name);
|
||||
|
||||
/**
|
||||
* Find all modules that are required by a module. If the module cannot be found, throw an exception.
|
||||
*
|
||||
* @throws ModuleNotFoundException
|
||||
*/
|
||||
public function findRequirements($name): array;
|
||||
|
||||
/**
|
||||
* Find a specific module. If there return that, otherwise throw exception.
|
||||
*
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findOrFail(string $name);
|
||||
|
||||
public function getModulePath($moduleName);
|
||||
|
||||
/**
|
||||
* @return Filesystem
|
||||
*/
|
||||
public function getFiles();
|
||||
|
||||
/**
|
||||
* Get a specific config data from a configuration file.
|
||||
*
|
||||
* @param string|null $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function config(string $key, $default = null);
|
||||
|
||||
/**
|
||||
* Get a module path.
|
||||
*/
|
||||
public function getPath(): string;
|
||||
|
||||
/**
|
||||
* Find a specific module by its alias.
|
||||
*
|
||||
* @return Module|void
|
||||
*/
|
||||
public function findByAlias(string $alias);
|
||||
|
||||
/**
|
||||
* Boot the modules.
|
||||
*/
|
||||
public function boot(): void;
|
||||
|
||||
/**
|
||||
* Register the modules.
|
||||
*/
|
||||
public function register(): void;
|
||||
|
||||
/**
|
||||
* Get asset path for a specific module.
|
||||
*/
|
||||
public function assetPath(string $module): string;
|
||||
|
||||
/**
|
||||
* Delete a specific module.
|
||||
*
|
||||
* @throws ModuleNotFoundException
|
||||
*/
|
||||
public function delete(string $module): bool;
|
||||
|
||||
/**
|
||||
* Determine whether the given module is activated.
|
||||
*
|
||||
* @throws ModuleNotFoundException
|
||||
*/
|
||||
public function isEnabled(string $name): bool;
|
||||
|
||||
/**
|
||||
* Determine whether the given module is not activated.
|
||||
*
|
||||
* @throws ModuleNotFoundException
|
||||
*/
|
||||
public function isDisabled(string $name): bool;
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace mpba\Modules\Contracts;
|
||||
|
||||
interface RunableInterface
|
||||
{
|
||||
/**
|
||||
* Run the specified command.
|
||||
*
|
||||
* @param string $command
|
||||
*/
|
||||
public function run($command);
|
||||
}
|
||||
Reference in New Issue
Block a user