فهرست منبع

Getter for app structure

Ecconia 7 سال پیش
والد
کامیت
10b4700791
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      src/Handler/MyHandler.php

+ 10 - 0
src/Handler/MyHandler.php

@@ -15,6 +15,7 @@ use Psr\Http\Message\{
 };
 
 use RS\DummyData;
+use RS\Application\AppPattern;
 
 class MyHandler extends Handler {
 	public function soos(ServerRequestInterface $request, ResponseInterface $response, \stdClass $args): ResponseInterface {
@@ -125,6 +126,14 @@ class MyHandler extends Handler {
 		return $response->withJson($a[$id]);
 	}
 
+	public function appPattern(ServerRequestInterface $request, ResponseInterface $response, \stdClass $args): ResponseInterface {
+		$appPattern = new AppPattern();
+
+		$obj['instruction'] = $appPattern->instruction;
+		$obj['fields'] = $appPattern->fields;
+		return $response->withJson($obj);
+	}
+
 	public static function getRoutes(): array {
 		return [
 			new Route('GET', '/soos', 'soos'),
@@ -133,6 +142,7 @@ class MyHandler extends Handler {
 			new Route('GET', '/applications', 'applications'),
 			new Route('GET', '/dummies', 'dummies'),
 			new Route('GET', '/application/{id:[0-9]+}', 'application'),
+			new Route('GET', '/app-pattern', 'appPattern'),
 		];
 	}
 }