mirror of
https://github.com/friendica/friendica
synced 2025-04-29 10:24:23 +02:00
Make BaseModule
a real entity
- Add all dependencies, necessary to run the content (baseUrl, Arguments) - Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule - Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well)
This commit is contained in:
parent
238613fd01
commit
8bdd90066f
252 changed files with 615 additions and 623 deletions
|
@ -2,59 +2,20 @@
|
|||
|
||||
namespace Friendica\Capabilities;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
/**
|
||||
* This interface provides the capability to handle requests from clients and returns the desired outcome
|
||||
*/
|
||||
interface ICanHandleRequests
|
||||
{
|
||||
/**
|
||||
* Module GET method to display raw content from technical endpoints
|
||||
* @param array $post The $_POST content (in case of POST)
|
||||
* @param array $request The $_REQUEST content (in case of GET, POST)
|
||||
*
|
||||
* Extend this method if the module is supposed to return communication data,
|
||||
* e.g. from protocol implementations.
|
||||
*/
|
||||
public function rawContent();
|
||||
|
||||
/**
|
||||
* Module GET method to display any content
|
||||
* @return string Returns the content of the module as string
|
||||
*
|
||||
* Extend this method if the module is supposed to return any display
|
||||
* through a GET request. It can be an HTML page through templating or a
|
||||
* XML feed or a JSON output.
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function content(): string;
|
||||
|
||||
/**
|
||||
* Module DELETE method to process submitted data
|
||||
*
|
||||
* Extend this method if the module is supposed to process DELETE requests.
|
||||
* Doesn't display any content
|
||||
*/
|
||||
public function delete();
|
||||
|
||||
/**
|
||||
* Module PATCH method to process submitted data
|
||||
*
|
||||
* Extend this method if the module is supposed to process PATCH requests.
|
||||
* Doesn't display any content
|
||||
*/
|
||||
public function patch();
|
||||
|
||||
/**
|
||||
* Module POST method to process submitted data
|
||||
*
|
||||
* Extend this method if the module is supposed to process POST requests.
|
||||
* Doesn't display any content
|
||||
*/
|
||||
public function post();
|
||||
|
||||
/**
|
||||
* Module PUT method to process submitted data
|
||||
*
|
||||
* Extend this method if the module is supposed to process PUT requests.
|
||||
* Doesn't display any content
|
||||
*/
|
||||
public function put();
|
||||
|
||||
public function getClassName(): string;
|
||||
public function run(array $post = [], array $request = []): string;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue