From 14df635b2f0c24ec5b108d262d48ab8e0fbd68c2 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 13 Dec 2017 00:03:42 +0100 Subject: [PATCH] upd: notice.api:3.0 (updated links @4 (to test)) --- notice/api/3.0.md | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/notice/api/3.0.md b/notice/api/3.0.md index 413c4b6..e72d824 100644 --- a/notice/api/3.0.md +++ b/notice/api/3.0.md @@ -41,7 +41,18 @@ Plan - [**2** Core implementation](#2---core-implementation) - [Classes](#classes) - [Methods](#methods) - - [Method arguments](#Method-arguments) + - [Method arguments](#method-arguments) + - [Return statement](#return-statement) + - [Before and After scripts](#before-and-after-scripts) + - [Example](#example) + +[**V.** Type Checker](#v-type-checker) + +- [**1** Permissions : AuthSystem](#1---permissions--authsystem) +- [**2** Core implementation](#2---core-implementation) + - [Classes](#classes) + - [Methods](#methods) + - [Method arguments](#method-arguments) - [Return statement](#return-statement) - [Example](#example) @@ -331,6 +342,10 @@ If you don't return the 'error' field, by default to [ 'error' => new \error\core\Error(\error\core\Err::Success) ] ``` +### Before and After scripts + +Each time a **method** is called, the api **creates an instance** from the class, and after the execution, the class is **destroyed**. So you can implement the methods `__construct` and `__destruct` to add before and after scripts. + ### example For instance here, we manage the call `GET /article/2` where `2` is the argument `URL0` renamed to `id_article`. @@ -365,7 +380,7 @@ public function GET($parameters){ *Note*: Functions `get_article_from_database()` and `has_error()` do not exist, it was in order for all to understand the example -## **3** Type Checker +# **V.** Type Checker `\api\core\Checker` checks the input values according to the type given in the configuration. @@ -396,11 +411,4 @@ To add a new type, just open the file `/build/api/Checker.php` and add an entry |`array`|`a`|Array containing only entries matching the type `a`| > **Note:** It is possible to chain `array` type as many as needed. -**Ex.:** `array>` - Will only match an array containing arrays that only contains `id` entries. - - -## **4** Advanced - -### Before and After scripts - -Each time a **method** is called, the api **creates an instance** from the class, and after the execution, the class is **destroyed**. So you can implement the methods `__construct` and `__destruct` to add before and after scripts. \ No newline at end of file +**Ex.:** `array>` - Will only match an array containing arrays that only contains `id` entries. \ No newline at end of file