{ "Api Controller": { "scope": "php,tpl.php", "prefix": "apicontroller", "body": [ "/**", " * Karaka", " *", " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", " * @license OMS License 1.0", " * @version 1.0.0", " * @link https://jingga.app", " */", "declare(strict_types=1);", "", "namespace Modules\\\\$1\\Controller;", "", "use phpOMS\\Account\\Account;", "use phpOMS\\Localization\\ISO639x1Enum;", "use phpOMS\\Message\\NotificationLevel;", "use phpOMS\\Message\\RequestAbstract;", "use phpOMS\\Message\\ResponseAbstract;", "use phpOMS\\Model\\Message\\FormValidation;", "use phpOMS\\Utils\\Parser\\Markdown\\Markdown;", "", "/**", " * $1 controller class.", " *", " * @package Modules\\\\$1", " * @license OMS License 1.0", " * @link https://jingga.app", " * @since 1.0.0", " */", "final class ApiController extends Controller", "{", "", "}", "" ], "description": "Create a api controller" }, "Null Model": { "scope": "php,tpl.php", "prefix": "nullmodel", "body": [ "/**", " * Karaka", " *", " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", " * @license OMS License 1.0", " * @version 1.0.0", " * @link https://jingga.app", " */", "declare(strict_types=1);", "", "namespace Modules\\\\$1\\Models;", "", "/**", " * Null model", " *", " * @package Modules\\\\$1", " * @license OMS License 1.0", " * @link https://jingga.app", " * @since 1.0.0", " */", "class Null$2 extends $2", "{", "}", "" ], "description": "Create a Null Model" }, "Model": { "scope": "php,tpl.php", "prefix": "model", "body": [ "/**", " * Karaka", " *", " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", " * @license OMS License 1.0", " * @version 1.0.0", " * @link https://jingga.app", " */", "declare(strict_types=1);", "", "namespace Modules\\\\$1\\Models;", "", "/**", " * Null model", " *", " * @package Modules\\\\$1", " * @license OMS License 1.0", " * @link https://jingga.app", " * @since 1.0.0", " */", "class $2 implements \\JsonSerializable", "{", " private \\$id = 0;", "", " public function getId() : int", " {", " return \\$this->id;", " }", "", " /**", " * {@inheritdoc}", " */", " public function toArray() : array", " {", " return [", " 'id' => \\$this->id,", " ];", " }", "", " /**", " * {@inheritdoc}", " */", " public function __toString()", " {", " return (string) \\json_encode(\\$this->toArray());", " }", "", " /**", " * {@inheritdoc}", " */", " public function jsonSerialize()", " {", " eturn \\$this->toArray();", " }", "}", "" ], "description": "Create a Model" }, "Api Create": { "scope": "php,tpl.php", "prefix": "apicreate", "body": [ " /**", " * Api method to create a $1", " *", " * @param RequestAbstract \\$request Request", " * @param ResponseAbstract \\$response Response", " * @param mixed \\$data Generic data", " *", " * @return void", " *", " * @api", " *", " * @since 1.0.0", " */", " public function api$2Create(RequestAbstract \\$request, ResponseAbstract \\$response, \\$data = null) : void", " {", " if (!empty(\\$val = \\$this->validate$2Create(\\$request))) {", " \\$response->set('$1_create', new FormValidation(\\$val));", "", " return;", " }", "", " $$1 = \\$this->create$2FromRequest(\\$request);", " \\$this->createModel(\\$request->header->account, $$1, $2Mapper::class, '$1');", " \\$this->fillJsonResponse(\\$request, \\$response, NotificationLevel::OK, '$2', '$2 successfully created', $$1);", " }", "", " /**", " * Validate $1 from account create request", " *", " * @param RequestAbstract \\$request Request", " *", " * @return array", " *", " * @since 1.0.0", " */", " private function validate$2Create(RequestAbstract \\$request) : array", " {", " $val = [];", " if ((\\$val['account'] = empty(\\$request->getData('account')))", " ) {", " return $val;", " }", "", " return [];", " }", "", " /**", " * Method to create $1 from request.", " *", " * @param RequestAbstract \\$request Request", " *", " * @return $2", " *", " * @since 1.0.0", " */", " private function create$2FromRequest(RequestAbstract \\$request) : $2", " {", " $$1 = new $2();", "", " return $$1;", " }", "" ], "description": "Create a model in the api controller" }, "Enum Create": { "scope": "php", "prefix": "enum", "body": [ "/**", " * Karaka", " *", " * PHP Version 8.1", " *", " * @package Modules\\\\$1", " * @copyright Dennis Eichhorn", " * @license OMS License 1.0", " * @version 1.0.0", " * @link https://jingga.app", " */", "declare(strict_types=1);", "", "namespace Modules\\\\$1\\Models;", "", "use phpOMS\\Stdlib\\Base\\Enum;", "", "/**", " * $2 enum.", " *", " * @package Modules\\\\$1", " * @license OMS License 1.0", " * @link https://jingga.app", " * @since 1.0.0", " */", "abstract class $2 extends Enum", "{", " public const OPEN = 1;", "}", "" ], "description": "Create an enum" } }