elevenone /
stardust
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types = 1); |
||
| 4 | |||
| 5 | namespace App\Domain; |
||
| 6 | |||
| 7 | use DarkMatter\Domain\Domain; |
||
| 8 | |||
| 9 | use DarkMatter\Payload\Payload; |
||
| 10 | use DarkMatter\Payload\Status; |
||
| 11 | |||
| 12 | // https://github.com/radarphp/Radar.Adr/blob/2.x/src/Responder/Responder.php |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Class HomeDomain |
||
| 16 | * |
||
| 17 | * This is a very simple domain which is normally used to provide some kind of data for you views. |
||
| 18 | * |
||
| 19 | * @package DarkMatterApp\Domains |
||
| 20 | */ |
||
| 21 | class HomeDomainPayloadTwo extends Domain |
||
| 22 | { |
||
| 23 | public function __construct(array $id) |
||
| 24 | { |
||
| 25 | $this->id = $id['id']; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Retrieves welcome text. |
||
| 30 | * |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | public function getWelcomePayload() : Payload |
||
| 34 | { |
||
| 35 | // get the data from the db or filesystem |
||
| 36 | $payload_dymmy_data = [ |
||
| 37 | 'body' => 'welcome to stardust / darkmatter', |
||
| 38 | 'extras' => [ |
||
| 39 | 'message' => 'welcome to stardust / darkmatter', |
||
| 40 | 'note' => 'message from: ' . __CLASS__, |
||
| 41 | 'button' => '<a href="http://localhost:8000">index</a>', |
||
| 42 | 'button2' => '<a href="/payloadtest/">payloadtest</a>', |
||
| 43 | 'button3' => '<a href="/payloadtest/43545">payloadtest/43545</a>', |
||
| 44 | 'id' => $this->id |
||
| 45 | ] |
||
| 46 | ]; |
||
| 47 | |||
| 48 | // if we get the data or file or whatever, then set the payload STATUS to FOUND |
||
| 49 | $payload = new Payload(Status::FOUND, $payload_dymmy_data); |
||
| 50 | |||
| 51 | return $payload; |
||
|
0 ignored issues
–
show
|
|||
| 52 | } |
||
| 53 | } |
||
| 54 |