upd: notice.api:3.0 (updated links @4 (to test))
This commit is contained in:
parent
ea8f8377f8
commit
14df635b2f
|
@ -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>`|`a`|Array containing only entries matching the type `a`|
|
||||
|
||||
> **Note:** It is possible to chain `array` type as many as needed.
|
||||
**Ex.:** `array<array<id>>` - 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.
|
||||
**Ex.:** `array<array<id>>` - Will only match an array containing arrays that only contains `id` entries.
|
Loading…
Reference in New Issue