1 | <?php |
||
12 | class ResultException extends IkResultException |
||
13 | { |
||
14 | |||
15 | /****************************************************************************** |
||
16 | * STATUS |
||
17 | ******************************************************************************/ |
||
18 | |||
19 | const STATUS_RETRY = 'retry'; |
||
20 | const STATUS_REDIRECT = 'redirect'; |
||
21 | const STATUS_QUEUED = 'queued'; |
||
22 | |||
23 | /****************************************************************************** |
||
24 | * RESULTS |
||
25 | ******************************************************************************/ |
||
26 | |||
27 | const R_QUEUED = 1; |
||
28 | const R_RETRY = 6; |
||
29 | const R_REDIRECT = 7; |
||
30 | const FAILURE_MAX_ATTEMPTS = 8; |
||
31 | |||
32 | /****************************************************************************** |
||
33 | * LOGIC |
||
34 | * |
||
35 | * COMMON codes 0xx |
||
36 | * |
||
37 | * FAILURE codes 2xx |
||
38 | * ERROR codes 4xx |
||
39 | * |
||
40 | * RETRIES codes 6xx |
||
41 | * REDIRECTS codes 7xx |
||
42 | * RETRIES + REDIRECTS codes 8xx |
||
43 | ******************************************************************************/ |
||
44 | |||
45 | /** |
||
46 | * Common results scope with message and status |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | public static $results |
||
51 | = [ |
||
52 | self::R_QUEUED => array( |
||
53 | self::P_MESSAGE => 'queued ...', |
||
54 | self::P_STATUS => self::STATUS_QUEUED, |
||
55 | ), |
||
56 | self::R_REDIRECT => array( |
||
57 | self::P_MESSAGE => 'redirect ...', |
||
58 | self::P_STATUS => self::STATUS_REDIRECT, |
||
59 | ), |
||
60 | self::R_RETRY => array( |
||
61 | self::P_MESSAGE => 'retry ...', |
||
62 | self::P_STATUS => self::STATUS_RETRY, |
||
63 | ), |
||
64 | self::FAILURE_MAX_ATTEMPTS => array( |
||
65 | self::P_MESSAGE => 'failure max retries ...', |
||
66 | self::P_STATUS => self::STATUS_FAILURE, |
||
67 | ), |
||
68 | ]; |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Check for 'queued' status |
||
73 | * |
||
74 | * @return boolean |
||
75 | */ |
||
76 | 1 | public function isQueued() |
|
80 | |||
81 | /** |
||
82 | * Check for 'retry' status |
||
83 | * |
||
84 | * @return boolean |
||
85 | */ |
||
86 | 3 | public function isRetry() |
|
90 | |||
91 | /** |
||
92 | * Check for 'redirect' status |
||
93 | * |
||
94 | * @return boolean |
||
95 | */ |
||
96 | 3 | public function isRedirect() |
|
100 | |||
101 | } |
||
102 | |||
104 |