Completed
Push — master ( bd47c4...b1ec47 )
by
unknown
02:41
created
src/Main.php 2 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -6,204 +6,204 @@
 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
-	/**
35
-	 * Getter for $statusCode
36
-	 * @author Shima Payro <[email protected]>
37
-	 * @since May 2, 2016 9:46:27 AM
38
-	 * @uses
39
-	 * @see
40
-	 */
41
-	public function getStatusCode() {
42
-
43
-		return $this->statusCode;
44
-
45
-	}
46
-
47
-	/**
48
-	 * Setter for $statusCode
49
-	 * @param integer $statusCode
50
-	 * @return App\Htpp\Responds\Respond
51
-	 * @author Shima Payro <[email protected]>
52
-	 * @since May 2, 2016 9:47:04 AM
53
-	 * @uses
54
-	 * @see
55
-	 */
56
-	public function setStatusCode( $statusCode ) {
57
-
58
-		$this->statusCode = $statusCode;
59
-
60
-		return $this;
61
-
62
-	}
63
-
64
-	/**
65
-	 * Getter for $statusText
66
-	 * @author Shima Payro <[email protected]>
67
-	 * @since May 2, 2016 9:47:36 AM
68
-	 * @uses
69
-	 * @see
70
-	 */
71
-	public function getStatusText() {
72
-
73
-		return $this->statusText;
74
-
75
-	}
76
-
77
-	/**
78
-	 * Setter for $statusText
79
-	 * @param String $statusText
80
-	 * @return App\HtppApp\Htpp\Responds\Respond
81
-	 * @author Shima Payro <[email protected]>
82
-	 * @since May 2, 2016 9:48:23 AM
83
-	 * @uses
84
-	 * @see
85
-	 */
86
-	public function setStatusText( $statusText ) {
87
-
88
-		$this->statusText = $statusText;
89
-
90
-		return $this;
91
-
92
-	}
93
-
94
-	/**
95
-	 * Response
96
-	 * @param json $data
97
-	 * @return jsom
98
-	 * @author Shima Payro <[email protected]>
99
-	 * @since May 2, 2016 9:48:45 AM
100
-	 * @uses
101
-	 * @see
102
-	 */
103
-	public function respond( $data ) {
104
-
105
-		return response()->json( $data, $this->getStatusCode() );
106
-
107
-	}
108
-
109
-	/**
110
-	 * Response which conteins just a message
111
-	 * @param string $message
112
-	 * @author Shima Payro <[email protected]>
113
-	 * @since May 2, 2016 9:49:21 AM
114
-	 * @return json
115
-	 * @uses
116
-	 * @see
117
-	 */
118
-	public function respondWithMessage( $message = NULL ) {
119
-
120
-		$res[ 'status' ] = $this->getStatusText();
121
-
122
-		//if it's about failure
123
-		if ( $this->getErrorCode() ) {
124
-
125
-			$res[ 'error' ] = $this->getErrorCode();
126
-			$res[ 'message' ] = $this->getErrorMessage();
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
+ /**
35
+  * Getter for $statusCode
36
+  * @author Shima Payro <[email protected]>
37
+  * @since May 2, 2016 9:46:27 AM
38
+  * @uses
39
+  * @see
40
+  */
41
+ public function getStatusCode() {
42
+
43
+  return $this->statusCode;
44
+
45
+ }
46
+
47
+ /**
48
+  * Setter for $statusCode
49
+  * @param integer $statusCode
50
+  * @return App\Htpp\Responds\Respond
51
+  * @author Shima Payro <[email protected]>
52
+  * @since May 2, 2016 9:47:04 AM
53
+  * @uses
54
+  * @see
55
+  */
56
+ public function setStatusCode( $statusCode ) {
57
+
58
+  $this->statusCode = $statusCode;
59
+
60
+  return $this;
61
+
62
+ }
63
+
64
+ /**
65
+  * Getter for $statusText
66
+  * @author Shima Payro <[email protected]>
67
+  * @since May 2, 2016 9:47:36 AM
68
+  * @uses
69
+  * @see
70
+  */
71
+ public function getStatusText() {
72
+
73
+  return $this->statusText;
74
+
75
+ }
76
+
77
+ /**
78
+  * Setter for $statusText
79
+  * @param String $statusText
80
+  * @return App\HtppApp\Htpp\Responds\Respond
81
+  * @author Shima Payro <[email protected]>
82
+  * @since May 2, 2016 9:48:23 AM
83
+  * @uses
84
+  * @see
85
+  */
86
+ public function setStatusText( $statusText ) {
87
+
88
+  $this->statusText = $statusText;
89
+
90
+  return $this;
91
+
92
+ }
93
+
94
+ /**
95
+  * Response
96
+  * @param json $data
97
+  * @return jsom
98
+  * @author Shima Payro <[email protected]>
99
+  * @since May 2, 2016 9:48:45 AM
100
+  * @uses
101
+  * @see
102
+  */
103
+ public function respond( $data ) {
104
+
105
+  return response()->json( $data, $this->getStatusCode() );
106
+
107
+ }
108
+
109
+ /**
110
+  * Response which conteins just a message
111
+  * @param string $message
112
+  * @author Shima Payro <[email protected]>
113
+  * @since May 2, 2016 9:49:21 AM
114
+  * @return json
115
+  * @uses
116
+  * @see
117
+  */
118
+ public function respondWithMessage( $message = NULL ) {
119
+
120
+  $res[ 'status' ] = $this->getStatusText();
121
+
122
+  //if it's about failure
123
+  if ( $this->getErrorCode() ) {
124
+
125
+   $res[ 'error' ] = $this->getErrorCode();
126
+   $res[ 'message' ] = $this->getErrorMessage();
127 127
 			
128
-		} else {
128
+  } else {
129 129
 
130
-			$res[ 'message' ] = $message;
130
+   $res[ 'message' ] = $message;
131 131
 
132
-		}
132
+  }
133 133
 
134
-		return $this->respond( $res );
134
+  return $this->respond( $res );
135 135
 
136
-	}
136
+ }
137 137
 
138
-	/**
139
-	 * Set error code in our result
140
-	 * @author Mehdi Hosseini <[email protected]>
141
-	 * @since August 24, 2016
142
-	 * @param $errorCode integer
143
-	 * @return instance
144
-	 */
145
-	public function setErrorCode( $errorCode ) {
138
+ /**
139
+  * Set error code in our result
140
+  * @author Mehdi Hosseini <[email protected]>
141
+  * @since August 24, 2016
142
+  * @param $errorCode integer
143
+  * @return instance
144
+  */
145
+ public function setErrorCode( $errorCode ) {
146 146
 
147
-		$this->error = config( 'errors.' . $errorCode );
147
+  $this->error = config( 'errors.' . $errorCode );
148 148
 
149
-		$this->errorCode = $errorCode;
149
+  $this->errorCode = $errorCode;
150 150
 
151
-		return $this;
151
+  return $this;
152 152
 
153
-	}
153
+ }
154 154
 
155
-	/**
156
-	 * Return Error code
157
-	 * @author Mehdi Hosseini <[email protected]>
158
-	 * @since August 24, 2016
159
-	 * @return integer
160
-	 */
161
-	public function getErrorCode() {
155
+ /**
156
+  * Return Error code
157
+  * @author Mehdi Hosseini <[email protected]>
158
+  * @since August 24, 2016
159
+  * @return integer
160
+  */
161
+ public function getErrorCode() {
162 162
 
163
-		return $this->errorCode;
163
+  return $this->errorCode;
164 164
 
165
-	}
165
+ }
166 166
 
167
-	/**
168
-	 * Get error message
169
-	 * @author Mehdi Hosseini <[email protected]>
170
-	 * @since August 24, 2016
171
-	 * @return string
172
-	 */
173
-	public function getErrorMessage() {
167
+ /**
168
+  * Get error message
169
+  * @author Mehdi Hosseini <[email protected]>
170
+  * @since August 24, 2016
171
+  * @return string
172
+  */
173
+ public function getErrorMessage() {
174 174
 
175
-		return $this->error['message'];
175
+  return $this->error['message'];
176 176
 
177
-	}
177
+ }
178 178
 
179 179
 
180
-	/**
181
-	 * Response which contains status and data
182
-	 * @param json $data
183
-	 * @author Shima Payro <[email protected]>
184
-	 * @since May 2, 2016 9:50:19 AM
185
-	 * @return json
186
-	 * @uses
187
-	 * @see
188
-	 */
189
-	 public function respondWithResult( $data = NULL ) {
180
+ /**
181
+  * Response which contains status and data
182
+  * @param json $data
183
+  * @author Shima Payro <[email protected]>
184
+  * @since May 2, 2016 9:50:19 AM
185
+  * @return json
186
+  * @uses
187
+  * @see
188
+  */
189
+  public function respondWithResult( $data = NULL ) {
190 190
 
191
-		$res[ 'status' ] = $this->getStatusText();
191
+  $res[ 'status' ] = $this->getStatusText();
192 192
 
193
-		//if it's about laravel validation error
194
-		if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) {
193
+  //if it's about laravel validation error
194
+  if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) {
195 195
 
196
-			$res[ 'error' ] = $this->getErrorCode();
197
-			$res[ 'message' ] = $data;
196
+   $res[ 'error' ] = $this->getErrorCode();
197
+   $res[ 'message' ] = $data;
198 198
 
199
-		} else {
199
+  } else {
200 200
 
201
-			$res[ 'result' ] = $data;
201
+   $res[ 'result' ] = $data;
202 202
 
203
-		}
203
+  }
204 204
 
205
-		return $this->respond( $res );
205
+  return $this->respond( $res );
206 206
 
207
-	}
207
+ }
208 208
 
209 209
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @uses
54 54
 	 * @see
55 55
 	 */
56
-	public function setStatusCode( $statusCode ) {
56
+	public function setStatusCode($statusCode) {
57 57
 
58 58
 		$this->statusCode = $statusCode;
59 59
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @uses
84 84
 	 * @see
85 85
 	 */
86
-	public function setStatusText( $statusText ) {
86
+	public function setStatusText($statusText) {
87 87
 
88 88
 		$this->statusText = $statusText;
89 89
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * @uses
101 101
 	 * @see
102 102
 	 */
103
-	public function respond( $data ) {
103
+	public function respond($data) {
104 104
 
105
-		return response()->json( $data, $this->getStatusCode() );
105
+		return response()->json($data, $this->getStatusCode());
106 106
 
107 107
 	}
108 108
 
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	 * @uses
116 116
 	 * @see
117 117
 	 */
118
-	public function respondWithMessage( $message = NULL ) {
118
+	public function respondWithMessage($message = NULL) {
119 119
 
120 120
 		$res[ 'status' ] = $this->getStatusText();
121 121
 
122 122
 		//if it's about failure
123
-		if ( $this->getErrorCode() ) {
123
+		if ($this->getErrorCode()) {
124 124
 
125 125
 			$res[ 'error' ] = $this->getErrorCode();
126 126
 			$res[ 'message' ] = $this->getErrorMessage();
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 		}
133 133
 
134
-		return $this->respond( $res );
134
+		return $this->respond($res);
135 135
 
136 136
 	}
137 137
 
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @param $errorCode integer
143 143
 	 * @return instance
144 144
 	 */
145
-	public function setErrorCode( $errorCode ) {
145
+	public function setErrorCode($errorCode) {
146 146
 
147
-		$this->error = config( 'errors.' . $errorCode );
147
+		$this->error = config('errors.'.$errorCode);
148 148
 
149 149
 		$this->errorCode = $errorCode;
150 150
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	public function getErrorMessage() {
174 174
 
175
-		return $this->error['message'];
175
+		return $this->error[ 'message' ];
176 176
 
177 177
 	}
178 178
 
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 	 * @uses
187 187
 	 * @see
188 188
 	 */
189
-	 public function respondWithResult( $data = NULL ) {
189
+	 public function respondWithResult($data = NULL) {
190 190
 
191 191
 		$res[ 'status' ] = $this->getStatusText();
192 192
 
193 193
 		//if it's about laravel validation error
194
-		if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) {
194
+		if ($this->getErrorCode() && $this->getStatusCode() == 420) {
195 195
 
196 196
 			$res[ 'error' ] = $this->getErrorCode();
197 197
 			$res[ 'message' ] = $data;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 		}
204 204
 
205
-		return $this->respond( $res );
205
+		return $this->respond($res);
206 206
 
207 207
 	}
208 208
 
Please login to merge, or discard this patch.