inc\classes\User.php
User object
Getting, registrating
- Author
- Sergey Dilong
- License
- GPL-2.0
- Package
- Temply-Account\Objects
\User
Package: Temply-Account\Objects
Parameters
Returns
Details
Parameters
Returns
Parameters
Returns
Details
Parameters
Returns
Throws
Details
Parameters
Returns
Throws
Details
Parameters
Returns
Throws
Parameters
Returns
Throws
Details
Parameters
Throws
Details
Returns
Details
User class
OOP based object to control all connected with User
- Author
- Sergey Dilong
- License
- GPL-2.0
Properties

array $data = array()User data
Default value
array()Details- Type
- array
- See
- Access this field outside the class
Methods

ClassesToData(array<mixed,\User> $q, boolean $no_false = true) : \(array | array<mixed,\bool)> | voidstatic
Classes to Data
Extracts data from User classes
| Name | Type | Description |
|---|---|---|
| $q | array<mixed,\User> | Query |
| $no_false | boolean | If |
| Type | Description |
|---|---|
| \(array | array<mixed,\bool)> | void | Result |

ClassesToIds(array<mixed,\User> $q) : array<mixed,integer>static
Classes to IDs
Converts array of classes to array of IDs
| Name | Type | Description |
|---|---|---|
| $q | array<mixed,\User> | Users array |
| Type | Description |
|---|---|
| array<mixed,integer> | Result |

IdsToClasses(array<mixed,integer> $q, boolean $no_false = true, array $o = array()) : array<mixed,\User>static
IDs to Classes
Converts array of IDs to array of classes
| Name | Type | Description |
|---|---|---|
| $q | array<mixed,integer> | IDs array |
| $no_false | boolean | If |
| $o | array | Options for User object |
| Type | Description |
|---|---|
| array<mixed,\User> | Result |

InitByLogin(string $a, array $o = array()) : booleanInit By login
Find user in DB by login and inits by ID
| Name | Type | Description |
|---|---|---|
| $a | string | Login |
| $o | array | Options |
| Type | Description |
|---|---|
| boolean | If `true` - success |
| Exception | Description |
|---|---|
| \apiException | * [101] Login not found |

InitUser(integer $id, array $o = array()) : booleanInit user
Init user by ID
| Name | Type | Description |
|---|---|---|
| $id | integer | ID |
| $o | array | Options
|
| Type | Description |
|---|---|
| boolean | If `true` - success |
| Exception | Description |
|---|---|
| \apiException | * [105] ID not found |

ReInitUser( $o = array()) : arrayRe-Init user
Change options of already inited object
| Name | Type | Description |
|---|---|---|
| $o | New options |
| Type | Description |
|---|---|
| array | New data (self::data) |
| Exception | Description |
|---|---|
| \apiException | * [105] ID not found |

SignUp(array $d) : booleanSign Up
This function registers REAL user and calls Init method
| Name | Type | Description |
|---|---|---|
| $d | array | Data
|
| Type | Description |
|---|---|
| boolean | If `true` - success |
| Exception | Description |
|---|---|
| \apiException | * [200] DB error * [201] Unfilled required data * [202] Incorrect name * [203] Password is too long * [204] Incorrect login |

__construct(integer | string $query = 0, array $o = array()) : voidRouter
Get or register User
| Name | Type | Description |
|---|---|---|
| $query | integer | string | Query
|
| $o | array | Options
|
| Exception | Description |
|---|---|
| \apiException | * [101] Login not found * [105] ID not found * [200] DB error * [201] Unfilled required data * [202] Incorrect name * [203] Password is too long * [204] Incorrect login |

get() : arrayGet User data
Get all inited User's data
| Type | Description |
|---|---|
| array | If array length = 0 - init error |