Completed
Push — master ( a6cd6e...bb5a47 )
by
unknown
02:15
created
src/Messages.php 4 patches
Doc Comments   -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,6 @@  discard block
 block discarded – undo
99 99
 	/**
100 100
 	 * Update action is succeed
101 101
 	 * @author Shima Payro <[email protected]>
102
-	 * @param String $message
103 102
 	 * @since May 2, 2016 9:54:09 AM
104 103
 	 * @uses
105 104
 	 * @see
@@ -116,7 +115,6 @@  discard block
 block discarded – undo
116 115
 	/**
117 116
 	 * Insert action is faild
118 117
 	 * @author Shima Payro <[email protected]>
119
-	 * @param String $message
120 118
 	 * @since May 2, 2016 9:54:27 AM
121 119
 	 * @uses
122 120
 	 * @see
@@ -133,7 +131,6 @@  discard block
 block discarded – undo
133 131
 	/**
134 132
 	 * Database connection is refused
135 133
 	 * @author Shima Payro <[email protected]>
136
-	 * @param String $message
137 134
 	 * @since May 2, 2016 9:54:45 AM
138 135
 	 * @uses
139 136
 	 * @see
@@ -150,7 +147,6 @@  discard block
 block discarded – undo
150 147
 	/**
151 148
 	 * page requested is not found
152 149
 	 * @author Shima Payro <[email protected]>
153
-	 * @param String $message
154 150
 	 * @since May 2, 2016 9:55:20 AM
155 151
 	 * @uses
156 152
 	 * @see
@@ -167,7 +163,6 @@  discard block
 block discarded – undo
167 163
 	/**
168 164
 	 * Wrong parameters are entered
169 165
 	 * @author Shima Payro <[email protected]>
170
-	 * @param String $message
171 166
 	 * @since May 2, 2016 9:55:20 AM
172 167
 	 * @uses
173 168
 	 * @see
@@ -184,7 +179,6 @@  discard block
 block discarded – undo
184 179
 	/**
185 180
 	 * Method is not allowed
186 181
 	 * @author Shima Payro <[email protected]>
187
-	 * @param String $message
188 182
 	 * @since May 2, 2016 9:55:20 AM
189 183
 	 * @uses
190 184
 	 * @see
@@ -218,7 +212,6 @@  discard block
 block discarded – undo
218 212
 	/**
219 213
 	 * The request field is not found
220 214
 	 * @author Shima Payro <[email protected]>
221
-	 * @param String $message
222 215
 	 * @since May 2, 2016 9:55:20 AM
223 216
 	 * @uses
224 217
 	 * @see
Please login to merge, or discard this patch.
Indentation   +256 added lines, -256 removed lines patch added patch discarded remove patch
@@ -6,262 +6,262 @@
 block discarded – undo
6 6
 {
7 7
 
8 8
 
9
-	/**
10
-	 * Request succeeded and contains json result
11
-	 * @param array $data
12
-	 * @author Shima Payro <[email protected]>
13
-	 * @since May 2, 2016 9:50:51 AM
14
-	 * @uses
15
-	 * @see
16
-	 */
17
-	public function succeed( $data ) {
18
-
19
-		return $this->setStatusCode( 200 )
20
-					->setStatusText( 'success' )
21
-					->respondWithResult( $data );
22
-
23
-	}
24
-
25
-	/**
26
-	 * Delete action is succeed
27
-	 * @author Shima Payro <[email protected]>
28
-	 * @param String $message
29
-	 * @since May 2, 2016 9:52:05 AM
30
-	 * @uses
31
-	 * @see
32
-	 */
33
-	public function deleteSucceeded( $message ) {
34
-
35
-		if ( empty( $message ) )
36
-			$message = $this->config[ 'success' ][ 'delete' ];
37
-
38
-		return $this->setStatusCode( 200 )
39
-					->setStatusText( 'success' )
40
-					->respondWithMessage( $message );
41
-
42
-	}
43
-
44
-	/**
45
-	 * Update action is succeed
46
-	 * @author Shima Payro <[email protected]>
47
-	 * @param String $message
48
-	 * @since May 2, 2016 9:52:52 AM
49
-	 * @uses
50
-	 * @see
51
-	 */
52
-	public function updateSucceeded( $message ) {
53
-
54
-		if ( empty( $message ) )
55
-			$message = $this->config[ 'success' ][ 'update' ];
56
-
57
-		return $this->setStatusCode( 200 )
58
-					->setStatusText( 'success' )
59
-					->respondWithMessage( $message );
60
-
61
-	}
62
-
63
-	/**
64
-	 * Insert action is succeed
65
-	 * @author Shima Payro <[email protected]>
66
-	 * @param String $message
67
-	 * @since May 2, 2016 9:53:26 AM
68
-	 * @uses
69
-	 * @see
70
-	 */
71
-	public function insertSucceeded( $message ) {
72
-
73
-		if ( empty( $message ) )
74
-			$message = $this->config[ 'success' ][ 'insert' ];
75
-
76
-		return $this->setStatusCode( 200 )
77
-					->setStatusText( $this->config[ 'success' ][ 'message' ] )
78
-					->respondWithMessage( $message );
79
-
80
-	}
81
-
82
-	/**
83
-	 * Delete action is faild
84
-	 * @author Shima Payro <[email protected]>
85
-	 * @param String $message
86
-	 * @since May 2, 2016 9:53:53 AM
87
-	 * @uses
88
-	 * @see
89
-	 */
90
-	public function deleteFaild( $message ) {
91
-
92
-		return $this->setStatusCode( 447 )
93
-					->setStatusText( 'fail' )
94
-					->setErrorCode( 5447 )
95
-					->respondWithMessage( $message );
96
-
97
-	}
98
-
99
-	/**
100
-	 * Update action is succeed
101
-	 * @author Shima Payro <[email protected]>
102
-	 * @param String $message
103
-	 * @since May 2, 2016 9:54:09 AM
104
-	 * @uses
105
-	 * @see
106
-	 */
107
-	public function updateFaild() {
108
-
109
-		return $this->setStatusCode( 449 )
110
-					->setStatusText( 'fail' )
111
-					->setErrorCode( 5449 )
112
-					->respondWithMessage();
113
-
114
-	}
115
-
116
-	/**
117
-	 * Insert action is faild
118
-	 * @author Shima Payro <[email protected]>
119
-	 * @param String $message
120
-	 * @since May 2, 2016 9:54:27 AM
121
-	 * @uses
122
-	 * @see
123
-	 */
124
-	public function insertFaild() {
125
-
126
-		return $this->setStatusCode( 448 )
127
-					->setStatusText( 'fail' )
128
-					->setErrorCode( 5448 )
129
-					->respondWithMessage();
130
-
131
-	}
132
-
133
-	/**
134
-	 * Database connection is refused
135
-	 * @author Shima Payro <[email protected]>
136
-	 * @param String $message
137
-	 * @since May 2, 2016 9:54:45 AM
138
-	 * @uses
139
-	 * @see
140
-	 */
141
-	public function connectionRefused() {
142
-
143
-		return $this->setStatusCode( 445 )
144
-					->setStatusText( 'fail' )
145
-					->setErrorCode( 5445 )
146
-					->respondWithMessage();
147
-
148
-	}
149
-
150
-	/**
151
-	 * page requested is not found
152
-	 * @author Shima Payro <[email protected]>
153
-	 * @param String $message
154
-	 * @since May 2, 2016 9:55:20 AM
155
-	 * @uses
156
-	 * @see
157
-	 */
158
-	public function notFound() {
159
-
160
-		return $this->setStatusCode( 404 )
161
-					->setStatusText( 'fail' )
162
-					->setErrorCode( 5404 )
163
-					->respondWithMessage();
164
-
165
-	}
166
-
167
-	/**
168
-	 * Wrong parameters are entered
169
-	 * @author Shima Payro <[email protected]>
170
-	 * @param String $message
171
-	 * @since May 2, 2016 9:55:20 AM
172
-	 * @uses
173
-	 * @see
174
-	 */
175
-	public function wrongParameters() {
176
-
177
-		return $this->setStatusCode( 406 )
178
-					->setStatusText( 'fail' )
179
-					->setErrorCode( 5406 )
180
-					->respondWithMessage();
181
-
182
-	}
183
-
184
-	/**
185
-	 * Method is not allowed
186
-	 * @author Shima Payro <[email protected]>
187
-	 * @param String $message
188
-	 * @since May 2, 2016 9:55:20 AM
189
-	 * @uses
190
-	 * @see
191
-	 */
192
-	public function methodNotAllowed() {
193
-
194
-		return $this->setStatusCode( 405 )
195
-					->setStatusText( 'fail' )
196
-					->setErrorCode( 5405 )
197
-					->respondWithMessage();
198
-
199
-	}
200
-
201
-	/**
202
-	 * There ara validation errors
203
-	 * @author Shima Payro <[email protected]>
204
-	 * @param Array $data
205
-	 * @since May 2, 2016 9:55:20 AM
206
-	 * @uses
207
-	 * @see
208
-	 */
209
-	public function validationErrors( $data ) {
210
-
211
-		return $this->setStatusCode( 420 )
212
-					->setStatusText( 'fail' )
213
-					->setErrorCode( 5420 )
214
-					->respondWithResult( $data );
215
-
216
-	}
217
-
218
-	/**
219
-	 * The request field is not found
220
-	 * @author Shima Payro <[email protected]>
221
-	 * @param String $message
222
-	 * @since May 2, 2016 9:55:20 AM
223
-	 * @uses
224
-	 * @see
225
-	 */
226
-	public function requestFieldNotFound() {
227
-
228
-		return $this->setStatusCode( 446 )
229
-					->setStatusText( 'fail' )
230
-					->setErrorCode( 1001 )
231
-					->respondWithMessage();
232
-
233
-	}
234
-
235
-	/**
236
-	 * The request field is doublicated
237
-	 * @author Mehdi Hosseini <[email protected]>
238
-	 * @since August 24, 2016
239
-	 * @return json
240
-	 */
241
-	public function requestFieldDuplicated() {
242
-
243
-	  return $this->setStatusCode( 400 )
244
-					->setStatusText( 'fail' )
245
-					->SetErrorCode(1004)
246
-					->respondWithMessage();
247
-
248
-	}
249
-
250
-	/**
251
-	 * Custom error message according to error config file
252
-	 * @author Mehdi Hosseini <[email protected]>
253
-	 * @since August 24, 2016
254
-	 * @param $code integer
255
-	 * @return json
256
-	 */
257
-	public function error( $code ) {
258
-
259
-	  return $this->SetStatusCode( 400 )
260
-					->setStatusText( 'fail' )
261
-					->setErrorCode( $code )
262
-					->respondWithMessage();
263
-
264
-	}
9
+ /**
10
+  * Request succeeded and contains json result
11
+  * @param array $data
12
+  * @author Shima Payro <[email protected]>
13
+  * @since May 2, 2016 9:50:51 AM
14
+  * @uses
15
+  * @see
16
+  */
17
+ public function succeed( $data ) {
18
+
19
+  return $this->setStatusCode( 200 )
20
+     ->setStatusText( 'success' )
21
+     ->respondWithResult( $data );
22
+
23
+ }
24
+
25
+ /**
26
+  * Delete action is succeed
27
+  * @author Shima Payro <[email protected]>
28
+  * @param String $message
29
+  * @since May 2, 2016 9:52:05 AM
30
+  * @uses
31
+  * @see
32
+  */
33
+ public function deleteSucceeded( $message ) {
34
+
35
+  if ( empty( $message ) )
36
+   $message = $this->config[ 'success' ][ 'delete' ];
37
+
38
+  return $this->setStatusCode( 200 )
39
+     ->setStatusText( 'success' )
40
+     ->respondWithMessage( $message );
41
+
42
+ }
43
+
44
+ /**
45
+  * Update action is succeed
46
+  * @author Shima Payro <[email protected]>
47
+  * @param String $message
48
+  * @since May 2, 2016 9:52:52 AM
49
+  * @uses
50
+  * @see
51
+  */
52
+ public function updateSucceeded( $message ) {
53
+
54
+  if ( empty( $message ) )
55
+   $message = $this->config[ 'success' ][ 'update' ];
56
+
57
+  return $this->setStatusCode( 200 )
58
+     ->setStatusText( 'success' )
59
+     ->respondWithMessage( $message );
60
+
61
+ }
62
+
63
+ /**
64
+  * Insert action is succeed
65
+  * @author Shima Payro <[email protected]>
66
+  * @param String $message
67
+  * @since May 2, 2016 9:53:26 AM
68
+  * @uses
69
+  * @see
70
+  */
71
+ public function insertSucceeded( $message ) {
72
+
73
+  if ( empty( $message ) )
74
+   $message = $this->config[ 'success' ][ 'insert' ];
75
+
76
+  return $this->setStatusCode( 200 )
77
+     ->setStatusText( $this->config[ 'success' ][ 'message' ] )
78
+     ->respondWithMessage( $message );
79
+
80
+ }
81
+
82
+ /**
83
+  * Delete action is faild
84
+  * @author Shima Payro <[email protected]>
85
+  * @param String $message
86
+  * @since May 2, 2016 9:53:53 AM
87
+  * @uses
88
+  * @see
89
+  */
90
+ public function deleteFaild( $message ) {
91
+
92
+  return $this->setStatusCode( 447 )
93
+     ->setStatusText( 'fail' )
94
+     ->setErrorCode( 5447 )
95
+     ->respondWithMessage( $message );
96
+
97
+ }
98
+
99
+ /**
100
+  * Update action is succeed
101
+  * @author Shima Payro <[email protected]>
102
+  * @param String $message
103
+  * @since May 2, 2016 9:54:09 AM
104
+  * @uses
105
+  * @see
106
+  */
107
+ public function updateFaild() {
108
+
109
+  return $this->setStatusCode( 449 )
110
+     ->setStatusText( 'fail' )
111
+     ->setErrorCode( 5449 )
112
+     ->respondWithMessage();
113
+
114
+ }
115
+
116
+ /**
117
+  * Insert action is faild
118
+  * @author Shima Payro <[email protected]>
119
+  * @param String $message
120
+  * @since May 2, 2016 9:54:27 AM
121
+  * @uses
122
+  * @see
123
+  */
124
+ public function insertFaild() {
125
+
126
+  return $this->setStatusCode( 448 )
127
+     ->setStatusText( 'fail' )
128
+     ->setErrorCode( 5448 )
129
+     ->respondWithMessage();
130
+
131
+ }
132
+
133
+ /**
134
+  * Database connection is refused
135
+  * @author Shima Payro <[email protected]>
136
+  * @param String $message
137
+  * @since May 2, 2016 9:54:45 AM
138
+  * @uses
139
+  * @see
140
+  */
141
+ public function connectionRefused() {
142
+
143
+  return $this->setStatusCode( 445 )
144
+     ->setStatusText( 'fail' )
145
+     ->setErrorCode( 5445 )
146
+     ->respondWithMessage();
147
+
148
+ }
149
+
150
+ /**
151
+  * page requested is not found
152
+  * @author Shima Payro <[email protected]>
153
+  * @param String $message
154
+  * @since May 2, 2016 9:55:20 AM
155
+  * @uses
156
+  * @see
157
+  */
158
+ public function notFound() {
159
+
160
+  return $this->setStatusCode( 404 )
161
+     ->setStatusText( 'fail' )
162
+     ->setErrorCode( 5404 )
163
+     ->respondWithMessage();
164
+
165
+ }
166
+
167
+ /**
168
+  * Wrong parameters are entered
169
+  * @author Shima Payro <[email protected]>
170
+  * @param String $message
171
+  * @since May 2, 2016 9:55:20 AM
172
+  * @uses
173
+  * @see
174
+  */
175
+ public function wrongParameters() {
176
+
177
+  return $this->setStatusCode( 406 )
178
+     ->setStatusText( 'fail' )
179
+     ->setErrorCode( 5406 )
180
+     ->respondWithMessage();
181
+
182
+ }
183
+
184
+ /**
185
+  * Method is not allowed
186
+  * @author Shima Payro <[email protected]>
187
+  * @param String $message
188
+  * @since May 2, 2016 9:55:20 AM
189
+  * @uses
190
+  * @see
191
+  */
192
+ public function methodNotAllowed() {
193
+
194
+  return $this->setStatusCode( 405 )
195
+     ->setStatusText( 'fail' )
196
+     ->setErrorCode( 5405 )
197
+     ->respondWithMessage();
198
+
199
+ }
200
+
201
+ /**
202
+  * There ara validation errors
203
+  * @author Shima Payro <[email protected]>
204
+  * @param Array $data
205
+  * @since May 2, 2016 9:55:20 AM
206
+  * @uses
207
+  * @see
208
+  */
209
+ public function validationErrors( $data ) {
210
+
211
+  return $this->setStatusCode( 420 )
212
+     ->setStatusText( 'fail' )
213
+     ->setErrorCode( 5420 )
214
+     ->respondWithResult( $data );
215
+
216
+ }
217
+
218
+ /**
219
+  * The request field is not found
220
+  * @author Shima Payro <[email protected]>
221
+  * @param String $message
222
+  * @since May 2, 2016 9:55:20 AM
223
+  * @uses
224
+  * @see
225
+  */
226
+ public function requestFieldNotFound() {
227
+
228
+  return $this->setStatusCode( 446 )
229
+     ->setStatusText( 'fail' )
230
+     ->setErrorCode( 1001 )
231
+     ->respondWithMessage();
232
+
233
+ }
234
+
235
+ /**
236
+  * The request field is doublicated
237
+  * @author Mehdi Hosseini <[email protected]>
238
+  * @since August 24, 2016
239
+  * @return json
240
+  */
241
+ public function requestFieldDuplicated() {
242
+
243
+   return $this->setStatusCode( 400 )
244
+     ->setStatusText( 'fail' )
245
+     ->SetErrorCode(1004)
246
+     ->respondWithMessage();
247
+
248
+ }
249
+
250
+ /**
251
+  * Custom error message according to error config file
252
+  * @author Mehdi Hosseini <[email protected]>
253
+  * @since August 24, 2016
254
+  * @param $code integer
255
+  * @return json
256
+  */
257
+ public function error( $code ) {
258
+
259
+   return $this->SetStatusCode( 400 )
260
+     ->setStatusText( 'fail' )
261
+     ->setErrorCode( $code )
262
+     ->respondWithMessage();
263
+
264
+ }
265 265
 
266 266
 
267 267
 }
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 	 * @uses
15 15
 	 * @see
16 16
 	 */
17
-	public function succeed( $data ) {
17
+	public function succeed($data) {
18 18
 
19
-		return $this->setStatusCode( 200 )
20
-					->setStatusText( 'success' )
21
-					->respondWithResult( $data );
19
+		return $this->setStatusCode(200)
20
+					->setStatusText('success')
21
+					->respondWithResult($data);
22 22
 
23 23
 	}
24 24
 
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 * @uses
31 31
 	 * @see
32 32
 	 */
33
-	public function deleteSucceeded( $message ) {
33
+	public function deleteSucceeded($message) {
34 34
 
35
-		if ( empty( $message ) )
35
+		if (empty($message))
36 36
 			$message = $this->config[ 'success' ][ 'delete' ];
37 37
 
38
-		return $this->setStatusCode( 200 )
39
-					->setStatusText( 'success' )
40
-					->respondWithMessage( $message );
38
+		return $this->setStatusCode(200)
39
+					->setStatusText('success')
40
+					->respondWithMessage($message);
41 41
 
42 42
 	}
43 43
 
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 * @uses
50 50
 	 * @see
51 51
 	 */
52
-	public function updateSucceeded( $message ) {
52
+	public function updateSucceeded($message) {
53 53
 
54
-		if ( empty( $message ) )
54
+		if (empty($message))
55 55
 			$message = $this->config[ 'success' ][ 'update' ];
56 56
 
57
-		return $this->setStatusCode( 200 )
58
-					->setStatusText( 'success' )
59
-					->respondWithMessage( $message );
57
+		return $this->setStatusCode(200)
58
+					->setStatusText('success')
59
+					->respondWithMessage($message);
60 60
 
61 61
 	}
62 62
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 * @uses
69 69
 	 * @see
70 70
 	 */
71
-	public function insertSucceeded( $message ) {
71
+	public function insertSucceeded($message) {
72 72
 
73
-		if ( empty( $message ) )
73
+		if (empty($message))
74 74
 			$message = $this->config[ 'success' ][ 'insert' ];
75 75
 
76
-		return $this->setStatusCode( 200 )
77
-					->setStatusText( $this->config[ 'success' ][ 'message' ] )
78
-					->respondWithMessage( $message );
76
+		return $this->setStatusCode(200)
77
+					->setStatusText($this->config[ 'success' ][ 'message' ])
78
+					->respondWithMessage($message);
79 79
 
80 80
 	}
81 81
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 * @uses
88 88
 	 * @see
89 89
 	 */
90
-	public function deleteFaild( $message ) {
90
+	public function deleteFaild($message) {
91 91
 
92
-		return $this->setStatusCode( 447 )
93
-					->setStatusText( 'fail' )
94
-					->setErrorCode( 5447 )
95
-					->respondWithMessage( $message );
92
+		return $this->setStatusCode(447)
93
+					->setStatusText('fail')
94
+					->setErrorCode(5447)
95
+					->respondWithMessage($message);
96 96
 
97 97
 	}
98 98
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function updateFaild() {
108 108
 
109
-		return $this->setStatusCode( 449 )
110
-					->setStatusText( 'fail' )
111
-					->setErrorCode( 5449 )
109
+		return $this->setStatusCode(449)
110
+					->setStatusText('fail')
111
+					->setErrorCode(5449)
112 112
 					->respondWithMessage();
113 113
 
114 114
 	}
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function insertFaild() {
125 125
 
126
-		return $this->setStatusCode( 448 )
127
-					->setStatusText( 'fail' )
128
-					->setErrorCode( 5448 )
126
+		return $this->setStatusCode(448)
127
+					->setStatusText('fail')
128
+					->setErrorCode(5448)
129 129
 					->respondWithMessage();
130 130
 
131 131
 	}
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function connectionRefused() {
142 142
 
143
-		return $this->setStatusCode( 445 )
144
-					->setStatusText( 'fail' )
145
-					->setErrorCode( 5445 )
143
+		return $this->setStatusCode(445)
144
+					->setStatusText('fail')
145
+					->setErrorCode(5445)
146 146
 					->respondWithMessage();
147 147
 
148 148
 	}
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function notFound() {
159 159
 
160
-		return $this->setStatusCode( 404 )
161
-					->setStatusText( 'fail' )
162
-					->setErrorCode( 5404 )
160
+		return $this->setStatusCode(404)
161
+					->setStatusText('fail')
162
+					->setErrorCode(5404)
163 163
 					->respondWithMessage();
164 164
 
165 165
 	}
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function wrongParameters() {
176 176
 
177
-		return $this->setStatusCode( 406 )
178
-					->setStatusText( 'fail' )
179
-					->setErrorCode( 5406 )
177
+		return $this->setStatusCode(406)
178
+					->setStatusText('fail')
179
+					->setErrorCode(5406)
180 180
 					->respondWithMessage();
181 181
 
182 182
 	}
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function methodNotAllowed() {
193 193
 
194
-		return $this->setStatusCode( 405 )
195
-					->setStatusText( 'fail' )
196
-					->setErrorCode( 5405 )
194
+		return $this->setStatusCode(405)
195
+					->setStatusText('fail')
196
+					->setErrorCode(5405)
197 197
 					->respondWithMessage();
198 198
 
199 199
 	}
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 	 * @uses
207 207
 	 * @see
208 208
 	 */
209
-	public function validationErrors( $data ) {
209
+	public function validationErrors($data) {
210 210
 
211
-		return $this->setStatusCode( 420 )
212
-					->setStatusText( 'fail' )
213
-					->setErrorCode( 5420 )
214
-					->respondWithResult( $data );
211
+		return $this->setStatusCode(420)
212
+					->setStatusText('fail')
213
+					->setErrorCode(5420)
214
+					->respondWithResult($data);
215 215
 
216 216
 	}
217 217
 
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function requestFieldNotFound() {
227 227
 
228
-		return $this->setStatusCode( 446 )
229
-					->setStatusText( 'fail' )
230
-					->setErrorCode( 1001 )
228
+		return $this->setStatusCode(446)
229
+					->setStatusText('fail')
230
+					->setErrorCode(1001)
231 231
 					->respondWithMessage();
232 232
 
233 233
 	}
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function requestFieldDuplicated() {
242 242
 
243
-	  return $this->setStatusCode( 400 )
244
-					->setStatusText( 'fail' )
243
+	  return $this->setStatusCode(400)
244
+					->setStatusText('fail')
245 245
 					->SetErrorCode(1004)
246 246
 					->respondWithMessage();
247 247
 
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 	 * @param $code integer
255 255
 	 * @return json
256 256
 	 */
257
-	public function error( $code ) {
257
+	public function error($code) {
258 258
 
259
-	  return $this->SetStatusCode( 400 )
260
-					->setStatusText( 'fail' )
261
-					->setErrorCode( $code )
259
+	  return $this->SetStatusCode(400)
260
+					->setStatusText('fail')
261
+					->setErrorCode($code)
262 262
 					->respondWithMessage();
263 263
 
264 264
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function deleteSucceeded( $message ) {
34 34
 
35
-		if ( empty( $message ) )
36
-			$message = $this->config[ 'success' ][ 'delete' ];
35
+		if ( empty( $message ) ) {
36
+					$message = $this->config[ 'success' ][ 'delete' ];
37
+		}
37 38
 
38 39
 		return $this->setStatusCode( 200 )
39 40
 					->setStatusText( 'success' )
@@ -51,8 +52,9 @@  discard block
 block discarded – undo
51 52
 	 */
52 53
 	public function updateSucceeded( $message ) {
53 54
 
54
-		if ( empty( $message ) )
55
-			$message = $this->config[ 'success' ][ 'update' ];
55
+		if ( empty( $message ) ) {
56
+					$message = $this->config[ 'success' ][ 'update' ];
57
+		}
56 58
 
57 59
 		return $this->setStatusCode( 200 )
58 60
 					->setStatusText( 'success' )
@@ -70,8 +72,9 @@  discard block
 block discarded – undo
70 72
 	 */
71 73
 	public function insertSucceeded( $message ) {
72 74
 
73
-		if ( empty( $message ) )
74
-			$message = $this->config[ 'success' ][ 'insert' ];
75
+		if ( empty( $message ) ) {
76
+					$message = $this->config[ 'success' ][ 'insert' ];
77
+		}
75 78
 
76 79
 		return $this->setStatusCode( 200 )
77 80
 					->setStatusText( $this->config[ 'success' ][ 'message' ] )
Please login to merge, or discard this patch.
errors/lang/fa.php 1 patch
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -2,180 +2,180 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-	'success' => [
6
-
7
-		'insert'	=> '.درخواست با موفقیت درج شده است',
8
-
9
-		'delete'	=> '.درخواست با موفقیت پاک شده است',
10
-
11
-		'update'	=> '.درخواست با موفقیت ویرایش  شده است'
12
-
13
-	],
14
-
15
-	1001 => [
16
-		'message' => '.درخواست مورد نظر پیدا نشد',
17
-		'type' => 'error'
18
-	],
19
-
20
-	1002 => [
21
-		'message' => '.کاربر مورد نظر موجود نیست',
22
-		'type' => 'error'
23
-	],
24
-
25
-	1003 => [
26
-		'message' => '.نوع کاربری وارد نشده است',
27
-		'type' => 'error'
28
-	],
29
-
30
-	1004 => [
31
-		'message' => '.خطا برای تکراری بودن',
32
-		'type' => 'error'
33
-	],
34
-
35
-	1005 => [
36
-		'message' => '.خطا برای تکراری بودن نقش کاربر',
37
-		'type' => 'error'
38
-	],
39
-
40
-	3001 => [
41
-		'message' => '.شما لاگین نیستید',
42
-		'type' => 'error',
43
-		'cat' => 'auth',
44
-		'short' => 'not-logged-on'
45
-	],
46
-
47
-	3002 => [
48
-		'message' => '.اپ توکن درست تولید نشده است',
49
-		'type' => 'error',
50
-		'cat' => 'auth'
51
-	],
52
-
53
-	3003 =>[
54
-		'message' => '.توکن کاربر درست تولید نشده است',
55
-		'type' => 'error',
56
-		'cat' => 'auth'
57
-	],
58
-
59
-	3004 => [
60
-		'message' => '.هیچ آژانسی به توکن دسترسی ندارد',
61
-		'type' => 'error',
62
-		'cat' => 'auth'
63
-	],
64
-
65
-	3005 => [
66
-		'message' => '.توکن درخواست شده شمامل اطلاعات کاربر نیست',
67
-		'type' => 'error',
68
-		'cat' => 'auth'
69
-	],
70
-
71
-	3006 => [
72
-		'message' => '.توکن درخواستی ست نشده است',
73
-		'type' => 'error',
74
-		'cat' => 'auth'
75
-	],
76
-
77
-	3007 => [
78
-		'message' => '.توکن نمایش داده نمیشود',
79
-		'type' => 'error',
80
-		'cat' => 'auth'
81
-	],
82
-
83
-	3008 => [
84
-		'message' => '.توکن برای شناسایی کاربر تولید نمیشود',
85
-		'type' => 'error',
86
-		'cat' => 'auth'
87
-	],
88
-
89
-	3009 => [
90
-		'message' => '.توکن تولید نمیشود',
91
-		'type' => 'error',
92
-		'cat' => 'auth'
93
-	],
94
-
95
-	3010 => [
96
-		'message' => '.زمان استفاده از توکن گذشته است',
97
-		'type' => 'error',
98
-		'cat' => 'auth'
99
-	],
100
-
101
-	3011 => [
102
-		'message' => '.توکن معتبر نیست',
103
-		'type' => 'error',
104
-		'cat' => 'auth'
105
-	],
106
-
107
-	3012 => [
108
-		'message' => '.توکن در لیست سیاه',
109
-		'type' => 'error',
110
-		'cat' => 'auth'
111
-	],
112
-
113
-	3013 => [
114
-		'message' => '.Payload معتبر نیست',
115
-		'type' => 'error',
116
-		'cat' => 'auth'
117
-	],
118
-
119
-	3014 => [
120
-		'message' => '.Claim معتبر نیست',
121
-		'type' => 'error',
122
-		'cat' => 'auth'
123
-	],
124
-
125
-	3015 => [
126
-		'message' => '.خطا به دلیل اعتبار سنجی توکن',
127
-		'type' => 'error',
128
-		'cat' => 'auth'
129
-	],
130
-
131
-	5401 => [
132
-		'message' => '.شناسایی کاربر نامعتبر است',
133
-		'type' => 'error'
134
-	],
135
-
136
-	5404 => [
137
-		'message' => '.صفحه درخواست شده پیدا نمیشود',
138
-		'type' => 'error'
139
-	],
140
-
141
-	5405 => [
142
-		'message' => '.شما به درخواستی که داده اید دسترسی ندارید',
143
-		'type' => 'error'
144
-	],
145
-
146
-	5406 => [
147
-		'message' => '.پارامترهایی که شما وارد کرده اید نا معتبر است',
148
-		'type' => 'error'
149
-	],
150
-
151
-	5420 => [
152
-		'message' => '.خطای اعتبار سنجی',
153
-		'type' => 'error'
154
-	],
155
-
156
-	5422 => [
157
-		'message' => '.توکن نامعتبر است',
158
-		'type' => 'error'
159
-	],
160
-
161
-	5445 => [
162
-		'message' => '.ارتباط با پایگاه داده مشکل دارد',
163
-		'type' => 'error'
164
-	],
165
-
166
-	5448 => [
167
-		'message' => '.عملیات درج درست اجرا نشده است',
168
-		'type' => 'error'
169
-	],
170
-
171
-	5447 => [
172
-		'message' => '.عملیات پاک کردن درست اجرا نشده است',
173
-		'type' => 'error'
174
-	],
175
-
176
-	5449 => [
177
-		'message' => '.عملیات ویرایش درست اجرا نشده است',
178
-		'type' => 'error'
179
-	]
5
+ 'success' => [
6
+
7
+  'insert'	=> '.درخواست با موفقیت درج شده است',
8
+
9
+  'delete'	=> '.درخواست با موفقیت پاک شده است',
10
+
11
+  'update'	=> '.درخواست با موفقیت ویرایش  شده است'
12
+
13
+ ],
14
+
15
+ 1001 => [
16
+  'message' => '.درخواست مورد نظر پیدا نشد',
17
+  'type' => 'error'
18
+ ],
19
+
20
+ 1002 => [
21
+  'message' => '.کاربر مورد نظر موجود نیست',
22
+  'type' => 'error'
23
+ ],
24
+
25
+ 1003 => [
26
+  'message' => '.نوع کاربری وارد نشده است',
27
+  'type' => 'error'
28
+ ],
29
+
30
+ 1004 => [
31
+  'message' => '.خطا برای تکراری بودن',
32
+  'type' => 'error'
33
+ ],
34
+
35
+ 1005 => [
36
+  'message' => '.خطا برای تکراری بودن نقش کاربر',
37
+  'type' => 'error'
38
+ ],
39
+
40
+ 3001 => [
41
+  'message' => '.شما لاگین نیستید',
42
+  'type' => 'error',
43
+  'cat' => 'auth',
44
+  'short' => 'not-logged-on'
45
+ ],
46
+
47
+ 3002 => [
48
+  'message' => '.اپ توکن درست تولید نشده است',
49
+  'type' => 'error',
50
+  'cat' => 'auth'
51
+ ],
52
+
53
+ 3003 =>[
54
+  'message' => '.توکن کاربر درست تولید نشده است',
55
+  'type' => 'error',
56
+  'cat' => 'auth'
57
+ ],
58
+
59
+ 3004 => [
60
+  'message' => '.هیچ آژانسی به توکن دسترسی ندارد',
61
+  'type' => 'error',
62
+  'cat' => 'auth'
63
+ ],
64
+
65
+ 3005 => [
66
+  'message' => '.توکن درخواست شده شمامل اطلاعات کاربر نیست',
67
+  'type' => 'error',
68
+  'cat' => 'auth'
69
+ ],
70
+
71
+ 3006 => [
72
+  'message' => '.توکن درخواستی ست نشده است',
73
+  'type' => 'error',
74
+  'cat' => 'auth'
75
+ ],
76
+
77
+ 3007 => [
78
+  'message' => '.توکن نمایش داده نمیشود',
79
+  'type' => 'error',
80
+  'cat' => 'auth'
81
+ ],
82
+
83
+ 3008 => [
84
+  'message' => '.توکن برای شناسایی کاربر تولید نمیشود',
85
+  'type' => 'error',
86
+  'cat' => 'auth'
87
+ ],
88
+
89
+ 3009 => [
90
+  'message' => '.توکن تولید نمیشود',
91
+  'type' => 'error',
92
+  'cat' => 'auth'
93
+ ],
94
+
95
+ 3010 => [
96
+  'message' => '.زمان استفاده از توکن گذشته است',
97
+  'type' => 'error',
98
+  'cat' => 'auth'
99
+ ],
100
+
101
+ 3011 => [
102
+  'message' => '.توکن معتبر نیست',
103
+  'type' => 'error',
104
+  'cat' => 'auth'
105
+ ],
106
+
107
+ 3012 => [
108
+  'message' => '.توکن در لیست سیاه',
109
+  'type' => 'error',
110
+  'cat' => 'auth'
111
+ ],
112
+
113
+ 3013 => [
114
+  'message' => '.Payload معتبر نیست',
115
+  'type' => 'error',
116
+  'cat' => 'auth'
117
+ ],
118
+
119
+ 3014 => [
120
+  'message' => '.Claim معتبر نیست',
121
+  'type' => 'error',
122
+  'cat' => 'auth'
123
+ ],
124
+
125
+ 3015 => [
126
+  'message' => '.خطا به دلیل اعتبار سنجی توکن',
127
+  'type' => 'error',
128
+  'cat' => 'auth'
129
+ ],
130
+
131
+ 5401 => [
132
+  'message' => '.شناسایی کاربر نامعتبر است',
133
+  'type' => 'error'
134
+ ],
135
+
136
+ 5404 => [
137
+  'message' => '.صفحه درخواست شده پیدا نمیشود',
138
+  'type' => 'error'
139
+ ],
140
+
141
+ 5405 => [
142
+  'message' => '.شما به درخواستی که داده اید دسترسی ندارید',
143
+  'type' => 'error'
144
+ ],
145
+
146
+ 5406 => [
147
+  'message' => '.پارامترهایی که شما وارد کرده اید نا معتبر است',
148
+  'type' => 'error'
149
+ ],
150
+
151
+ 5420 => [
152
+  'message' => '.خطای اعتبار سنجی',
153
+  'type' => 'error'
154
+ ],
155
+
156
+ 5422 => [
157
+  'message' => '.توکن نامعتبر است',
158
+  'type' => 'error'
159
+ ],
160
+
161
+ 5445 => [
162
+  'message' => '.ارتباط با پایگاه داده مشکل دارد',
163
+  'type' => 'error'
164
+ ],
165
+
166
+ 5448 => [
167
+  'message' => '.عملیات درج درست اجرا نشده است',
168
+  'type' => 'error'
169
+ ],
170
+
171
+ 5447 => [
172
+  'message' => '.عملیات پاک کردن درست اجرا نشده است',
173
+  'type' => 'error'
174
+ ],
175
+
176
+ 5449 => [
177
+  'message' => '.عملیات ویرایش درست اجرا نشده است',
178
+  'type' => 'error'
179
+ ]
180 180
 
181 181
 ];
Please login to merge, or discard this patch.
errors/lang/en.php 1 patch
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -2,186 +2,186 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-	'success' => [
6
-
7
-		'insert'	=> 'The requested parameter is Added successfully!',
8
-
9
-		'delete'	=> 'The requested parameter is deleted successfully!',
10
-
11
-		'update'	=> 'The requested parameter is updated successfully!'
12
-
13
-	],
14
-
15
-	1001 => [
16
-		'message' => 'Oops... Requested field is not found!',
17
-		'type' => 'error'
18
-	],
19
-
20
-	1002 => [
21
-		'message' => 'Oops... Requested User does not exists!',
22
-		'type' => 'error'
23
-	],
24
-
25
-	1003 => [
26
-		'message' => 'Oops... Client type is not entered!',
27
-		'type' => 'error'
28
-	],
29
-
30
-	1004 => [
31
-		'message' => 'Failed because of duplicate',
32
-		'type' => 'error'
33
-	],
34
-
35
-	1005 => [
36
-		'message' => 'Failed because of dablicated user role',
37
-		'type' => 'error'
38
-	],
39
-
40
-	3001 => [
41
-		'message' => 'You are not logged on',
42
-		'type' => 'error',
43
-		'cat' => 'auth',
44
-		'short' => 'not-logged-on'
45
-	],
46
-
47
-	3002 => [
48
-		'message' => 'Application token did not generated successfully',
49
-		'type' => 'error',
50
-		'cat' => 'auth'
51
-	],
52
-
53
-	3003 =>[
54
-		'message' => 'User token did not generated successfully',
55
-		'type' => 'error',
56
-		'cat' => 'auth'
57
-	],
58
-
59
-	3004 => [
60
-		'message' => 'Request token have no agency access',
61
-		'type' => 'error',
62
-		'cat' => 'auth'
63
-	],
64
-
65
-	3005 => [
66
-		'message' => 'Request token did not contains user information',
67
-		'type' => 'error',
68
-		'cat' => 'auth'
69
-	],
70
-
71
-	3006 => [
72
-		'message' => 'Did not set request token',
73
-		'type' => 'error',
74
-		'cat' => 'auth'
75
-	],
76
-
77
-	3007 => [
78
-		'message' => 'can not decode the token',
79
-		'type' => 'error',
80
-		'cat' => 'auth'
81
-	],
82
-
83
-	3008 => [
84
-		'message' => 'can not generate token for authentication',
85
-		'type' => 'error',
86
-		'cat' => 'auth'
87
-	],
88
-
89
-	3009 => [
90
-		'message' => 'can not create token',
91
-		'type' => 'error',
92
-		'cat' => 'auth'
93
-	],
94
-
95
-	3010 => [
96
-		'message' => 'Token expired!',
97
-		'type' => 'error',
98
-		'cat' => 'auth'
99
-	],
100
-
101
-	3011 => [
102
-		'message' => 'Token is invalid!',
103
-		'type' => 'error',
104
-		'cat' => 'auth'
105
-	],
106
-
107
-	3012 => [
108
-		'message' => 'Token Blacklisted',
109
-		'type' => 'error',
110
-		'cat' => 'auth'
111
-	],
112
-
113
-	3013 => [
114
-		'message' => 'Payload invalid!',
115
-		'type' => 'error',
116
-		'cat' => 'auth'
117
-	],
118
-
119
-	3014 => [
120
-		'message' => 'Claim Invalid',
121
-		'type' => 'error',
122
-		'cat' => 'auth'
123
-	],
124
-
125
-	3015 => [
126
-		'message' => 'An error occurred on token validation',
127
-		'type' => 'error',
128
-		'cat' => 'auth'
129
-	],
130
-
131
-	3016 => [
132
-
133
-		'message' => 'This domain has been blocked',
134
-		'type' => 'error'
135
-	]
136
-
137
-	5401 => [
138
-		'message' => 'Authentication unauthorized...',
139
-		'type' => 'error'
140
-	],
141
-
142
-	5404 => [
143
-		'message' => 'Oops... The requested page not found!',
144
-		'type' => 'error'
145
-	],
146
-
147
-	5405 => [
148
-		'message' => 'Oops... The method you requested is not allowed!',
149
-		'type' => 'error'
150
-	],
151
-
152
-	5406 => [
153
-		'message' => 'Oops... The parameters you entered are wrong!',
154
-		'type' => 'error'
155
-	],
156
-
157
-	5420 => [
158
-		'message' => 'Validation Error',
159
-		'type' => 'error'
160
-	],
161
-
162
-	5422 => [
163
-		'message' => 'Token is not valid',
164
-		'type' => 'error'
165
-	],
166
-
167
-	5445 => [
168
-		'message' => 'Oops... Database connection refused',
169
-		'type' => 'error'
170
-	],
171
-
172
-	5448 => [
173
-		'message' => 'Oops... Insert action was not successfully executed',
174
-		'type' => 'error'
175
-	],
176
-
177
-	5447 => [
178
-		'message' => 'Oops... Delete action was not successfully executed',
179
-		'type' => 'error'
180
-	],
181
-
182
-	5449 => [
183
-		'message' => 'Oops... Update action was not successfully executed',
184
-		'type' => 'error'
185
-	]
5
+ 'success' => [
6
+
7
+  'insert'	=> 'The requested parameter is Added successfully!',
8
+
9
+  'delete'	=> 'The requested parameter is deleted successfully!',
10
+
11
+  'update'	=> 'The requested parameter is updated successfully!'
12
+
13
+ ],
14
+
15
+ 1001 => [
16
+  'message' => 'Oops... Requested field is not found!',
17
+  'type' => 'error'
18
+ ],
19
+
20
+ 1002 => [
21
+  'message' => 'Oops... Requested User does not exists!',
22
+  'type' => 'error'
23
+ ],
24
+
25
+ 1003 => [
26
+  'message' => 'Oops... Client type is not entered!',
27
+  'type' => 'error'
28
+ ],
29
+
30
+ 1004 => [
31
+  'message' => 'Failed because of duplicate',
32
+  'type' => 'error'
33
+ ],
34
+
35
+ 1005 => [
36
+  'message' => 'Failed because of dablicated user role',
37
+  'type' => 'error'
38
+ ],
39
+
40
+ 3001 => [
41
+  'message' => 'You are not logged on',
42
+  'type' => 'error',
43
+  'cat' => 'auth',
44
+  'short' => 'not-logged-on'
45
+ ],
46
+
47
+ 3002 => [
48
+  'message' => 'Application token did not generated successfully',
49
+  'type' => 'error',
50
+  'cat' => 'auth'
51
+ ],
52
+
53
+ 3003 =>[
54
+  'message' => 'User token did not generated successfully',
55
+  'type' => 'error',
56
+  'cat' => 'auth'
57
+ ],
58
+
59
+ 3004 => [
60
+  'message' => 'Request token have no agency access',
61
+  'type' => 'error',
62
+  'cat' => 'auth'
63
+ ],
64
+
65
+ 3005 => [
66
+  'message' => 'Request token did not contains user information',
67
+  'type' => 'error',
68
+  'cat' => 'auth'
69
+ ],
70
+
71
+ 3006 => [
72
+  'message' => 'Did not set request token',
73
+  'type' => 'error',
74
+  'cat' => 'auth'
75
+ ],
76
+
77
+ 3007 => [
78
+  'message' => 'can not decode the token',
79
+  'type' => 'error',
80
+  'cat' => 'auth'
81
+ ],
82
+
83
+ 3008 => [
84
+  'message' => 'can not generate token for authentication',
85
+  'type' => 'error',
86
+  'cat' => 'auth'
87
+ ],
88
+
89
+ 3009 => [
90
+  'message' => 'can not create token',
91
+  'type' => 'error',
92
+  'cat' => 'auth'
93
+ ],
94
+
95
+ 3010 => [
96
+  'message' => 'Token expired!',
97
+  'type' => 'error',
98
+  'cat' => 'auth'
99
+ ],
100
+
101
+ 3011 => [
102
+  'message' => 'Token is invalid!',
103
+  'type' => 'error',
104
+  'cat' => 'auth'
105
+ ],
106
+
107
+ 3012 => [
108
+  'message' => 'Token Blacklisted',
109
+  'type' => 'error',
110
+  'cat' => 'auth'
111
+ ],
112
+
113
+ 3013 => [
114
+  'message' => 'Payload invalid!',
115
+  'type' => 'error',
116
+  'cat' => 'auth'
117
+ ],
118
+
119
+ 3014 => [
120
+  'message' => 'Claim Invalid',
121
+  'type' => 'error',
122
+  'cat' => 'auth'
123
+ ],
124
+
125
+ 3015 => [
126
+  'message' => 'An error occurred on token validation',
127
+  'type' => 'error',
128
+  'cat' => 'auth'
129
+ ],
130
+
131
+ 3016 => [
132
+
133
+  'message' => 'This domain has been blocked',
134
+  'type' => 'error'
135
+ ]
136
+
137
+ 5401 => [
138
+  'message' => 'Authentication unauthorized...',
139
+  'type' => 'error'
140
+ ],
141
+
142
+ 5404 => [
143
+  'message' => 'Oops... The requested page not found!',
144
+  'type' => 'error'
145
+ ],
146
+
147
+ 5405 => [
148
+  'message' => 'Oops... The method you requested is not allowed!',
149
+  'type' => 'error'
150
+ ],
151
+
152
+ 5406 => [
153
+  'message' => 'Oops... The parameters you entered are wrong!',
154
+  'type' => 'error'
155
+ ],
156
+
157
+ 5420 => [
158
+  'message' => 'Validation Error',
159
+  'type' => 'error'
160
+ ],
161
+
162
+ 5422 => [
163
+  'message' => 'Token is not valid',
164
+  'type' => 'error'
165
+ ],
166
+
167
+ 5445 => [
168
+  'message' => 'Oops... Database connection refused',
169
+  'type' => 'error'
170
+ ],
171
+
172
+ 5448 => [
173
+  'message' => 'Oops... Insert action was not successfully executed',
174
+  'type' => 'error'
175
+ ],
176
+
177
+ 5447 => [
178
+  'message' => 'Oops... Delete action was not successfully executed',
179
+  'type' => 'error'
180
+ ],
181
+
182
+ 5449 => [
183
+  'message' => 'Oops... Update action was not successfully executed',
184
+  'type' => 'error'
185
+ ]
186 186
 
187 187
 ];
Please login to merge, or discard this patch.
src/Main.php 3 patches
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -6,266 +6,266 @@
 block discarded – undo
6 6
 
7 7
 class Main {
8 8
 
9
-	/**
10
-	 * Http status code
11
-	 * @var integer
12
-	 */
13
-	protected $statusCode = 200;
14
-
15
-	/**
16
-	 * Status text
17
-	 * @var string
18
-	 */
19
-	protected $statusText = 'success';
20
-
21
-	/**
22
-	 * Error code, message and text-key
23
-	 * @var array
24
-	 */
25
-	protected $error;
26
-
27
-	/**
28
-	 * Error code
29
-	 * @var integer
30
-	 */
31
-	protected $errorCode;
32
-
33
-	/**
34
-	 * Haeders
35
-	 * @var array
36
-	 */
37
-	protected $headers = [];
38
-
39
-	/**
40
-	 * @var string
41
-	 */
42
-	protected $lang;
43
-
44
-	/**
45
-	 * @var arry
46
-	 */
47
-	protected $config;
48
-
49
-	/**
50
-	 * @author Shahrokh Niakan <[email protected]>
51
-	 * @since Sep 24, 2016
52
-	 */
53
-	public function __construct() {
54
-
55
-		$this->lang = \App::getLocale();
56
-
57
-		$this->config = include __DIR__ . '/../errors/lang/' . $this->lang . '.php';
58
-
59
-	}
60
-
61
-	/**
62
-	 * Getter for $statusCode
63
-	 * @author Shima Payro <[email protected]>
64
-	 * @since May 2, 2016 9:46:27 AM
65
-	 * @uses
66
-	 * @see
67
-	 */
68
-	public function getStatusCode() {
69
-
70
-		return $this->statusCode;
71
-
72
-	}
73
-
74
-	/**
75
-	 * Setter for $statusCode
76
-	 * @param integer $statusCode
77
-	 * @return App\Htpp\Responds\Respond
78
-	 * @author Shima Payro <[email protected]>
79
-	 * @since May 2, 2016 9:47:04 AM
80
-	 * @uses
81
-	 * @see
82
-	 */
83
-	public function setStatusCode( $statusCode ) {
84
-
85
-		$this->statusCode = $statusCode;
86
-
87
-		return $this;
88
-
89
-	}
9
+ /**
10
+  * Http status code
11
+  * @var integer
12
+  */
13
+ protected $statusCode = 200;
14
+
15
+ /**
16
+  * Status text
17
+  * @var string
18
+  */
19
+ protected $statusText = 'success';
20
+
21
+ /**
22
+  * Error code, message and text-key
23
+  * @var array
24
+  */
25
+ protected $error;
26
+
27
+ /**
28
+  * Error code
29
+  * @var integer
30
+  */
31
+ protected $errorCode;
32
+
33
+ /**
34
+  * Haeders
35
+  * @var array
36
+  */
37
+ protected $headers = [];
38
+
39
+ /**
40
+  * @var string
41
+  */
42
+ protected $lang;
43
+
44
+ /**
45
+  * @var arry
46
+  */
47
+ protected $config;
48
+
49
+ /**
50
+  * @author Shahrokh Niakan <[email protected]>
51
+  * @since Sep 24, 2016
52
+  */
53
+ public function __construct() {
54
+
55
+  $this->lang = \App::getLocale();
56
+
57
+  $this->config = include __DIR__ . '/../errors/lang/' . $this->lang . '.php';
58
+
59
+ }
60
+
61
+ /**
62
+  * Getter for $statusCode
63
+  * @author Shima Payro <[email protected]>
64
+  * @since May 2, 2016 9:46:27 AM
65
+  * @uses
66
+  * @see
67
+  */
68
+ public function getStatusCode() {
69
+
70
+  return $this->statusCode;
71
+
72
+ }
73
+
74
+ /**
75
+  * Setter for $statusCode
76
+  * @param integer $statusCode
77
+  * @return App\Htpp\Responds\Respond
78
+  * @author Shima Payro <[email protected]>
79
+  * @since May 2, 2016 9:47:04 AM
80
+  * @uses
81
+  * @see
82
+  */
83
+ public function setStatusCode( $statusCode ) {
84
+
85
+  $this->statusCode = $statusCode;
86
+
87
+  return $this;
88
+
89
+ }
90 90
 
91
-	/**
92
-	 * Getter for $statusText
93
-	 * @author Shima Payro <[email protected]>
94
-	 * @since May 2, 2016 9:47:36 AM
95
-	 * @uses
96
-	 * @see
97
-	 */
98
-	public function getStatusText() {
91
+ /**
92
+  * Getter for $statusText
93
+  * @author Shima Payro <[email protected]>
94
+  * @since May 2, 2016 9:47:36 AM
95
+  * @uses
96
+  * @see
97
+  */
98
+ public function getStatusText() {
99 99
 
100
-		return $this->statusText;
100
+  return $this->statusText;
101 101
 
102
-	}
102
+ }
103 103
 
104
-	/**
105
-	 * Setter for $statusText
106
-	 * @param String $statusText
107
-	 * @return App\HtppApp\Htpp\Responds\Respond
108
-	 * @author Shima Payro <[email protected]>
109
-	 * @since May 2, 2016 9:48:23 AM
110
-	 * @uses
111
-	 * @see
112
-	 */
113
-	public function setStatusText( $statusText ) {
104
+ /**
105
+  * Setter for $statusText
106
+  * @param String $statusText
107
+  * @return App\HtppApp\Htpp\Responds\Respond
108
+  * @author Shima Payro <[email protected]>
109
+  * @since May 2, 2016 9:48:23 AM
110
+  * @uses
111
+  * @see
112
+  */
113
+ public function setStatusText( $statusText ) {
114 114
 
115
-		$this->statusText = $statusText;
115
+  $this->statusText = $statusText;
116 116
 
117
-		return $this;
117
+  return $this;
118 118
 
119
-	}
119
+ }
120 120
 
121
-	/**
122
-	 * Response
123
-	 * @param json $data
124
-	 * @return jsom
125
-	 * @author Shima Payro <[email protected]>
126
-	 * @since May 2, 2016 9:48:45 AM
127
-	 * @uses
128
-	 * @see
129
-	 */
130
-	public function respond( $data ) {
121
+ /**
122
+  * Response
123
+  * @param json $data
124
+  * @return jsom
125
+  * @author Shima Payro <[email protected]>
126
+  * @since May 2, 2016 9:48:45 AM
127
+  * @uses
128
+  * @see
129
+  */
130
+ public function respond( $data ) {
131 131
 
132
-		$result = array_filter( $this->getHeaders() );
132
+  $result = array_filter( $this->getHeaders() );
133 133
 
134
-		if ( empty( $result ) )
135
-			return response()->json( $data, $this->getStatusCode() );
134
+  if ( empty( $result ) )
135
+   return response()->json( $data, $this->getStatusCode() );
136 136
 
137
-		return response()->json( $data, $this->getStatusCode() )
138
-						->withHeaders( $this->getHeaders() );
137
+  return response()->json( $data, $this->getStatusCode() )
138
+      ->withHeaders( $this->getHeaders() );
139 139
 
140
-	}
140
+ }
141 141
 
142
-	/**
143
-	 * Response which conteins just a message
144
-	 * @param string $message
145
-	 * @author Shima Payro <[email protected]>
146
-	 * @since May 2, 2016 9:49:21 AM
147
-	 * @return json
148
-	 * @uses
149
-	 * @see
150
-	 */
151
-	public function respondWithMessage( $message ) {
142
+ /**
143
+  * Response which conteins just a message
144
+  * @param string $message
145
+  * @author Shima Payro <[email protected]>
146
+  * @since May 2, 2016 9:49:21 AM
147
+  * @return json
148
+  * @uses
149
+  * @see
150
+  */
151
+ public function respondWithMessage( $message ) {
152 152
 
153
-		$res[ 'status' ] = $this->getStatusText();
153
+  $res[ 'status' ] = $this->getStatusText();
154 154
 
155
-		//if it's about failure
156
-		if ( $this->getErrorCode() ) {
155
+  //if it's about failure
156
+  if ( $this->getErrorCode() ) {
157 157
 
158
-			$res[ 'error' ] = $this->getErrorCode();
158
+   $res[ 'error' ] = $this->getErrorCode();
159 159
 
160
-			if ( empty( $message ) )
161
-				$res[ 'message' ] = $this->getErrorMessage();
160
+   if ( empty( $message ) )
161
+    $res[ 'message' ] = $this->getErrorMessage();
162 162
 
163
-			$res[ 'message' ] = $message;
163
+   $res[ 'message' ] = $message;
164 164
 
165
-		} else {
165
+  } else {
166 166
 
167
-			$res[ 'message' ] = $message;
167
+   $res[ 'message' ] = $message;
168 168
 
169
-		}
169
+  }
170 170
 
171
-		return $this->respond( $res );
171
+  return $this->respond( $res );
172 172
 
173
-	}
173
+ }
174 174
 
175
-	/**
176
-	 * Set error code in our result
177
-	 * @author Mehdi Hosseini <[email protected]>
178
-	 * @since August 24, 2016
179
-	 * @param $errorCode integer
180
-	 * @return instance
181
-	 */
182
-	public function setErrorCode( $errorCode ) {
175
+ /**
176
+  * Set error code in our result
177
+  * @author Mehdi Hosseini <[email protected]>
178
+  * @since August 24, 2016
179
+  * @param $errorCode integer
180
+  * @return instance
181
+  */
182
+ public function setErrorCode( $errorCode ) {
183 183
 
184
-		$this->error = $this->config[ $errorCode ];
184
+  $this->error = $this->config[ $errorCode ];
185 185
 
186
-		$this->errorCode = $errorCode;
186
+  $this->errorCode = $errorCode;
187 187
 
188
-		return $this;
188
+  return $this;
189 189
 
190
-	}
190
+ }
191 191
 
192
-	/**
193
-	 * Return Error code
194
-	 * @author Mehdi Hosseini <[email protected]>
195
-	 * @since August 24, 2016
196
-	 * @return integer
197
-	 */
198
-	public function getErrorCode() {
192
+ /**
193
+  * Return Error code
194
+  * @author Mehdi Hosseini <[email protected]>
195
+  * @since August 24, 2016
196
+  * @return integer
197
+  */
198
+ public function getErrorCode() {
199 199
 
200
-		return $this->errorCode;
200
+  return $this->errorCode;
201 201
 
202
-	}
202
+ }
203 203
 
204
-	/**
205
-	 * Get error message
206
-	 * @author Mehdi Hosseini <[email protected]>
207
-	 * @since August 24, 2016
208
-	 * @return string
209
-	 */
210
-	public function getErrorMessage() {
204
+ /**
205
+  * Get error message
206
+  * @author Mehdi Hosseini <[email protected]>
207
+  * @since August 24, 2016
208
+  * @return string
209
+  */
210
+ public function getErrorMessage() {
211 211
 
212
-		return $this->error['message'];
212
+  return $this->error['message'];
213 213
 
214
-	}
214
+ }
215 215
 
216
-	/**
217
-	 * Get headers
218
-	 * @author Shima Payro <[email protected]>
219
-	 * @since Sep 13, 2016
220
-	 * @return array
221
-	 */
222
-	public function getHeaders() {
216
+ /**
217
+  * Get headers
218
+  * @author Shima Payro <[email protected]>
219
+  * @since Sep 13, 2016
220
+  * @return array
221
+  */
222
+ public function getHeaders() {
223 223
 
224
-		return $this->headers;
224
+  return $this->headers;
225 225
 
226
-	}
226
+ }
227 227
 
228
-	/**
229
-	 * Set headers
230
-	 * @author Shima Payro <[email protected]>
231
-	 * @since Sep 13, 2016
232
-	 * @return array
233
-	 */
234
-	public function setHeaders( $headers = [] ) {
228
+ /**
229
+  * Set headers
230
+  * @author Shima Payro <[email protected]>
231
+  * @since Sep 13, 2016
232
+  * @return array
233
+  */
234
+ public function setHeaders( $headers = [] ) {
235 235
 
236
-		$this->headers = $headers;
236
+  $this->headers = $headers;
237 237
 
238
-		return $this;
238
+  return $this;
239 239
 
240
-	}
240
+ }
241 241
 
242
-	/**
243
-	 * Response which contains status and data
244
-	 * @param json $data
245
-	 * @author Shima Payro <[email protected]>
246
-	 * @since May 2, 2016 9:50:19 AM
247
-	 * @return json
248
-	 * @uses
249
-	 * @see
250
-	 */
251
-	 public function respondWithResult( $data = NULL ) {
242
+ /**
243
+  * Response which contains status and data
244
+  * @param json $data
245
+  * @author Shima Payro <[email protected]>
246
+  * @since May 2, 2016 9:50:19 AM
247
+  * @return json
248
+  * @uses
249
+  * @see
250
+  */
251
+  public function respondWithResult( $data = NULL ) {
252 252
 
253
-		$res[ 'status' ] = $this->getStatusText();
253
+  $res[ 'status' ] = $this->getStatusText();
254 254
 
255
-		//if it's about laravel validation error
256
-		if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) {
255
+  //if it's about laravel validation error
256
+  if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) {
257 257
 
258
-			$res[ 'error' ] = $this->getErrorCode();
259
-			$res[ 'message' ] = $data;
258
+   $res[ 'error' ] = $this->getErrorCode();
259
+   $res[ 'message' ] = $data;
260 260
 
261
-		} else {
261
+  } else {
262 262
 
263
-			$res[ 'result' ] = $data;
263
+   $res[ 'result' ] = $data;
264 264
 
265
-		}
265
+  }
266 266
 
267
-		return $this->respond( $res );
267
+  return $this->respond( $res );
268 268
 
269
-	}
269
+ }
270 270
 
271 271
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * Haeders
35 35
 	 * @var array
36 36
 	 */
37
-	protected $headers = [];
37
+	protected $headers = [ ];
38 38
 
39 39
 	/**
40 40
 	 * @var string
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->lang = \App::getLocale();
56 56
 
57
-		$this->config = include __DIR__ . '/../errors/lang/' . $this->lang . '.php';
57
+		$this->config = include __DIR__.'/../errors/lang/'.$this->lang.'.php';
58 58
 
59 59
 	}
60 60
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @uses
81 81
 	 * @see
82 82
 	 */
83
-	public function setStatusCode( $statusCode ) {
83
+	public function setStatusCode($statusCode) {
84 84
 
85 85
 		$this->statusCode = $statusCode;
86 86
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @uses
111 111
 	 * @see
112 112
 	 */
113
-	public function setStatusText( $statusText ) {
113
+	public function setStatusText($statusText) {
114 114
 
115 115
 		$this->statusText = $statusText;
116 116
 
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 	 * @uses
128 128
 	 * @see
129 129
 	 */
130
-	public function respond( $data ) {
130
+	public function respond($data) {
131 131
 
132
-		$result = array_filter( $this->getHeaders() );
132
+		$result = array_filter($this->getHeaders());
133 133
 
134
-		if ( empty( $result ) )
135
-			return response()->json( $data, $this->getStatusCode() );
134
+		if (empty($result))
135
+			return response()->json($data, $this->getStatusCode());
136 136
 
137
-		return response()->json( $data, $this->getStatusCode() )
138
-						->withHeaders( $this->getHeaders() );
137
+		return response()->json($data, $this->getStatusCode())
138
+						->withHeaders($this->getHeaders());
139 139
 
140 140
 	}
141 141
 
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 * @uses
149 149
 	 * @see
150 150
 	 */
151
-	public function respondWithMessage( $message ) {
151
+	public function respondWithMessage($message) {
152 152
 
153 153
 		$res[ 'status' ] = $this->getStatusText();
154 154
 
155 155
 		//if it's about failure
156
-		if ( $this->getErrorCode() ) {
156
+		if ($this->getErrorCode()) {
157 157
 
158 158
 			$res[ 'error' ] = $this->getErrorCode();
159 159
 
160
-			if ( empty( $message ) )
160
+			if (empty($message))
161 161
 				$res[ 'message' ] = $this->getErrorMessage();
162 162
 
163 163
 			$res[ 'message' ] = $message;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 		}
170 170
 
171
-		return $this->respond( $res );
171
+		return $this->respond($res);
172 172
 
173 173
 	}
174 174
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param $errorCode integer
180 180
 	 * @return instance
181 181
 	 */
182
-	public function setErrorCode( $errorCode ) {
182
+	public function setErrorCode($errorCode) {
183 183
 
184 184
 		$this->error = $this->config[ $errorCode ];
185 185
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function getErrorMessage() {
211 211
 
212
-		return $this->error['message'];
212
+		return $this->error[ 'message' ];
213 213
 
214 214
 	}
215 215
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @since Sep 13, 2016
232 232
 	 * @return array
233 233
 	 */
234
-	public function setHeaders( $headers = [] ) {
234
+	public function setHeaders($headers = [ ]) {
235 235
 
236 236
 		$this->headers = $headers;
237 237
 
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 	 * @uses
249 249
 	 * @see
250 250
 	 */
251
-	 public function respondWithResult( $data = NULL ) {
251
+	 public function respondWithResult($data = NULL) {
252 252
 
253 253
 		$res[ 'status' ] = $this->getStatusText();
254 254
 
255 255
 		//if it's about laravel validation error
256
-		if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) {
256
+		if ($this->getErrorCode() && $this->getStatusCode() == 420) {
257 257
 
258 258
 			$res[ 'error' ] = $this->getErrorCode();
259 259
 			$res[ 'message' ] = $data;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 		}
266 266
 
267
-		return $this->respond( $res );
267
+		return $this->respond($res);
268 268
 
269 269
 	}
270 270
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$result = array_filter( $this->getHeaders() );
133 133
 
134
-		if ( empty( $result ) )
135
-			return response()->json( $data, $this->getStatusCode() );
134
+		if ( empty( $result ) ) {
135
+					return response()->json( $data, $this->getStatusCode() );
136
+		}
136 137
 
137 138
 		return response()->json( $data, $this->getStatusCode() )
138 139
 						->withHeaders( $this->getHeaders() );
@@ -157,8 +158,9 @@  discard block
 block discarded – undo
157 158
 
158 159
 			$res[ 'error' ] = $this->getErrorCode();
159 160
 
160
-			if ( empty( $message ) )
161
-				$res[ 'message' ] = $this->getErrorMessage();
161
+			if ( empty( $message ) ) {
162
+							$res[ 'message' ] = $this->getErrorMessage();
163
+			}
162 164
 
163 165
 			$res[ 'message' ] = $message;
164 166
 
Please login to merge, or discard this patch.
src/RespondServiceProvider.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,44 +6,44 @@
 block discarded – undo
6 6
 
7 7
 class RespondServiceProvider extends ServiceProvider
8 8
 {
9
-	/**
10
-	* Perform post-registration booting of services.
11
-	*
12
-	* @return void
13
-	*/
14
-	public function boot()
15
-	{
9
+ /**
10
+  * Perform post-registration booting of services.
11
+  *
12
+  * @return void
13
+  */
14
+ public function boot()
15
+ {
16 16
 
17
-		$lang = \App::getLocale();
17
+  $lang = \App::getLocale();
18 18
 
19
-		$this->publishes([
20
-			__DIR__.'/../errors/lang/' . $lang . '.php' => config_path( $lang . '.php' ),
21
-		]);
19
+  $this->publishes([
20
+   __DIR__.'/../errors/lang/' . $lang . '.php' => config_path( $lang . '.php' ),
21
+  ]);
22 22
 
23
-	}
23
+ }
24 24
 
25 25
 
26
-	/**
27
-	* Register any package services.
28
-	*
29
-	* @return void
30
-	*/
31
-	public function register()
32
-	{
26
+ /**
27
+  * Register any package services.
28
+  *
29
+  * @return void
30
+  */
31
+ public function register()
32
+ {
33 33
 
34
-		$this->registerMessages();
34
+  $this->registerMessages();
35 35
 
36
-	}
36
+ }
37 37
 
38
-	private function registerMessages()
39
-	{
38
+ private function registerMessages()
39
+ {
40 40
 
41
-		$this->app->bind( 'Anetwork\Respond\Messages', function() {
41
+  $this->app->bind( 'Anetwork\Respond\Messages', function() {
42 42
 
43
-			return new Messages();
43
+   return new Messages();
44 44
 
45
-		});
45
+  });
46 46
 
47
-	}
47
+ }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		$lang = \App::getLocale();
18 18
 
19 19
 		$this->publishes([
20
-			__DIR__.'/../errors/lang/' . $lang . '.php' => config_path( $lang . '.php' ),
20
+			__DIR__.'/../errors/lang/'.$lang.'.php' => config_path($lang.'.php'),
21 21
 		]);
22 22
 
23 23
 	}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	private function registerMessages()
39 39
 	{
40 40
 
41
-		$this->app->bind( 'Anetwork\Respond\Messages', function() {
41
+		$this->app->bind('Anetwork\Respond\Messages', function() {
42 42
 
43 43
 			return new Messages();
44 44
 
Please login to merge, or discard this patch.