Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
2 / 2
ApiError
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
2 / 2
 values
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 labels
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
1<?php
2
3namespace App\Enums;
4
5use Kwaadpepper\Enum\BaseEnumRoutable;
6
7/**
8 * This describes an API error.
9 *
10 * @method static self modelNotFound()
11 * The request model was not found (typically the customer)
12 *
13 * @method static self validationFailed()
14 * This means some data could not be validated,
15 * you may have to look into message to get the details
16 *
17 * @method static self customerExists()
18 * The customer already exists
19 *
20 * @method static self customerNotActivated()
21 * The customer account is not activated and cannot perform
22 * this action
23 *
24 * @method static self customerAlreadyActive()
25 * You have requested to activate a customer account,
26 * but it is already active
27 *
28 * @method static self singleOptinCustomerExists()
29 * You have requested to create a single optin for an email,
30 * but it already exists
31 *
32 * @method static self apiAuthFailed()
33 * The authentification to the api failed. You may have to
34 * check into config or .env file for your service credentials
35 *
36 * @method static self authFailed()
37 * The authentification for this customer failed because of wrong credentials
38 *
39 * @method static self methodNotAllowed()
40 * This http method is not allowed
41 *
42 * @method static self wrongTimeStamp()
43 * The timestamp given is wrong. This would happen in case if
44 * a replay attack scenario. Timestamps are provided in headers
45 * and in the http body
46 *
47 * @method static self missingParameter()
48 * The request is missing some parameters
49 *
50 * @method static self throttleRequestsException()
51 * Too many requests have been attempted. The is a throttle security.
52 * Normally you should not trigger this.
53 * If this happens fill a ticket on https://supportweb.ldc.fr
54 * with some technical details
55 *
56 * @method static self authorizationException()
57 * You are maybe trying to access data that is out of your range.
58 * This should not happen normally, it is here to allow you to handle this case.
59 * If this happens fill a ticket on https://supportweb.ldc.fr
60 * with some technical details
61 *
62 * @package LDCCrmClient
63 * @subpackage enums
64 */
65class ApiError extends BaseEnumRoutable
66{
67    /**
68     * Valeurs des possibilités de cet énumération (value)
69     *
70     * @return array
71     */
72    public static function values(): array
73    {
74        return [
75            'modelNotFound' => 101,
76            'validationFailed' => 102,
77            'customerExists' => 103,
78            'customerAlreadyActive' => 110,
79            'customerNotActivated' => 116,
80            'authFailed' => 117,
81            'apiAuthFailed' => 119,
82            'singleOptinCustomerExists' => 120,
83            'methodNotAllowed' => 150,
84            'wrongTimeStamp' => 151,
85            'missingParameter' => 400,
86            'authorizationException' => 403,
87            'throttleRequestsException' => 429
88        ];
89    }
90
91    /**
92     * Libellés des possibilités de cet énumération (label)
93     *
94     * @return array
95     */
96    public static function labels(): array
97    {
98        return [
99            'modelNotFound' => '%s introuvable.',
100            'validationFailed' => 'Impossible de valider les données',
101            'customerExists' => 'L\'utilisateur est déjà enregistré sur ce site',
102            'customerNotActivated' => 'Le compte n\'est pas activé',
103            'customerAlreadyActive' => 'Le compte est déjà activé',
104            'singleOptinCustomerExists' => 'Le single optin ne peut être ajouté car un compte existe.',
105            'authFailed' => 'Echec de l\'authentification du compte',
106            'apiAuthFailed' => 'Echec de l\'authentification client à l\'Api LDC-CRM pour ce service',
107            'methodNotAllowed' => 'This method is not allowed for this request',
108            'wrongTimeStamp' => 'Your request is malformed, please check timestamp header and parameter',
109            'missingParameter' => 'The request is missing some parameters',
110            'authorizationException' => 'You are not autorized to access this',
111            'throttleRequestsException' => 'Throttle: too many request have been attempted, please retry later'
112        ];
113    }
114}