| @@ -341,6 +341,10 @@ | ||
| 341 | 341 | return $file; | 
| 342 | 342 | } | 
| 343 | 343 | |
| 344 | + /** | |
| 345 | + * @param string $class | |
| 346 | + * @param string $ext | |
| 347 | + */ | |
| 344 | 348 | private function findFileWithExtension($class, $ext) | 
| 345 | 349 |      { | 
| 346 | 350 | // PSR-4 lookup | 
| @@ -123,20 +123,20 @@ discard block | ||
| 123 | 123 | return; | 
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | - $first = $prefix[0]; | |
| 127 | -        if (!isset($this->prefixesPsr0[$first][$prefix])) { | |
| 128 | - $this->prefixesPsr0[$first][$prefix] = (array) $paths; | |
| 126 | + $first = $prefix[ 0 ]; | |
| 127 | +        if (!isset($this->prefixesPsr0[ $first ][ $prefix ])) { | |
| 128 | + $this->prefixesPsr0[ $first ][ $prefix ] = (array) $paths; | |
| 129 | 129 | |
| 130 | 130 | return; | 
| 131 | 131 | } | 
| 132 | 132 |          if ($prepend) { | 
| 133 | - $this->prefixesPsr0[$first][$prefix] = array_merge( | |
| 133 | + $this->prefixesPsr0[ $first ][ $prefix ] = array_merge( | |
| 134 | 134 | (array) $paths, | 
| 135 | - $this->prefixesPsr0[$first][$prefix] | |
| 135 | + $this->prefixesPsr0[ $first ][ $prefix ] | |
| 136 | 136 | ); | 
| 137 | 137 |          } else { | 
| 138 | - $this->prefixesPsr0[$first][$prefix] = array_merge( | |
| 139 | - $this->prefixesPsr0[$first][$prefix], | |
| 138 | + $this->prefixesPsr0[ $first ][ $prefix ] = array_merge( | |
| 139 | + $this->prefixesPsr0[ $first ][ $prefix ], | |
| 140 | 140 | (array) $paths | 
| 141 | 141 | ); | 
| 142 | 142 | } | 
| @@ -167,24 +167,24 @@ discard block | ||
| 167 | 167 | (array) $paths | 
| 168 | 168 | ); | 
| 169 | 169 | } | 
| 170 | -        } elseif (!isset($this->prefixDirsPsr4[$prefix])) { | |
| 170 | +        } elseif (!isset($this->prefixDirsPsr4[ $prefix ])) { | |
| 171 | 171 | // Register directories for a new namespace. | 
| 172 | 172 | $length = strlen($prefix); | 
| 173 | -            if ('\\' !== $prefix[$length - 1]) { | |
| 173 | +            if ('\\' !== $prefix[ $length - 1 ]) { | |
| 174 | 174 |                  throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); | 
| 175 | 175 | } | 
| 176 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; | |
| 177 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; | |
| 176 | + $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length; | |
| 177 | + $this->prefixDirsPsr4[ $prefix ] = (array) $paths; | |
| 178 | 178 |          } elseif ($prepend) { | 
| 179 | 179 | // Prepend directories for an already registered namespace. | 
| 180 | - $this->prefixDirsPsr4[$prefix] = array_merge( | |
| 180 | + $this->prefixDirsPsr4[ $prefix ] = array_merge( | |
| 181 | 181 | (array) $paths, | 
| 182 | - $this->prefixDirsPsr4[$prefix] | |
| 182 | + $this->prefixDirsPsr4[ $prefix ] | |
| 183 | 183 | ); | 
| 184 | 184 |          } else { | 
| 185 | 185 | // Append directories for an already registered namespace. | 
| 186 | - $this->prefixDirsPsr4[$prefix] = array_merge( | |
| 187 | - $this->prefixDirsPsr4[$prefix], | |
| 186 | + $this->prefixDirsPsr4[ $prefix ] = array_merge( | |
| 187 | + $this->prefixDirsPsr4[ $prefix ], | |
| 188 | 188 | (array) $paths | 
| 189 | 189 | ); | 
| 190 | 190 | } | 
| @@ -202,7 +202,7 @@ discard block | ||
| 202 | 202 |          if (!$prefix) { | 
| 203 | 203 | $this->fallbackDirsPsr0 = (array) $paths; | 
| 204 | 204 |          } else { | 
| 205 | - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; | |
| 205 | + $this->prefixesPsr0[ $prefix[ 0 ] ][ $prefix ] = (array) $paths; | |
| 206 | 206 | } | 
| 207 | 207 | } | 
| 208 | 208 | |
| @@ -221,11 +221,11 @@ discard block | ||
| 221 | 221 | $this->fallbackDirsPsr4 = (array) $paths; | 
| 222 | 222 |          } else { | 
| 223 | 223 | $length = strlen($prefix); | 
| 224 | -            if ('\\' !== $prefix[$length - 1]) { | |
| 224 | +            if ('\\' !== $prefix[ $length - 1 ]) { | |
| 225 | 225 |                  throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); | 
| 226 | 226 | } | 
| 227 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; | |
| 228 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; | |
| 227 | + $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length; | |
| 228 | + $this->prefixDirsPsr4[ $prefix ] = (array) $paths; | |
| 229 | 229 | } | 
| 230 | 230 | } | 
| 231 | 231 | |
| @@ -314,15 +314,15 @@ discard block | ||
| 314 | 314 | public function findFile($class) | 
| 315 | 315 |      { | 
| 316 | 316 | // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 | 
| 317 | -        if ('\\' == $class[0]) { | |
| 317 | +        if ('\\' == $class[ 0 ]) { | |
| 318 | 318 | $class = substr($class, 1); | 
| 319 | 319 | } | 
| 320 | 320 | |
| 321 | 321 | // class map lookup | 
| 322 | -        if (isset($this->classMap[$class])) { | |
| 323 | - return $this->classMap[$class]; | |
| 322 | +        if (isset($this->classMap[ $class ])) { | |
| 323 | + return $this->classMap[ $class ]; | |
| 324 | 324 | } | 
| 325 | -        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { | |
| 325 | +        if ($this->classMapAuthoritative || isset($this->missingClasses[ $class ])) { | |
| 326 | 326 | return false; | 
| 327 | 327 | } | 
| 328 | 328 | |
| @@ -335,7 +335,7 @@ discard block | ||
| 335 | 335 | |
| 336 | 336 |          if (false === $file) { | 
| 337 | 337 | // Remember that this class does not exist. | 
| 338 | - $this->missingClasses[$class] = true; | |
| 338 | + $this->missingClasses[ $class ] = true; | |
| 339 | 339 | } | 
| 340 | 340 | |
| 341 | 341 | return $file; | 
| @@ -344,14 +344,14 @@ discard block | ||
| 344 | 344 | private function findFileWithExtension($class, $ext) | 
| 345 | 345 |      { | 
| 346 | 346 | // PSR-4 lookup | 
| 347 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; | |
| 347 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; | |
| 348 | 348 | |
| 349 | - $first = $class[0]; | |
| 350 | -        if (isset($this->prefixLengthsPsr4[$first])) { | |
| 351 | -            foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { | |
| 349 | + $first = $class[ 0 ]; | |
| 350 | +        if (isset($this->prefixLengthsPsr4[ $first ])) { | |
| 351 | +            foreach ($this->prefixLengthsPsr4[ $first ] as $prefix => $length) { | |
| 352 | 352 |                  if (0 === strpos($class, $prefix)) { | 
| 353 | -                    foreach ($this->prefixDirsPsr4[$prefix] as $dir) { | |
| 354 | -                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { | |
| 353 | +                    foreach ($this->prefixDirsPsr4[ $prefix ] as $dir) { | |
| 354 | +                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) { | |
| 355 | 355 | return $file; | 
| 356 | 356 | } | 
| 357 | 357 | } | 
| @@ -361,7 +361,7 @@ discard block | ||
| 361 | 361 | |
| 362 | 362 | // PSR-4 fallback dirs | 
| 363 | 363 |          foreach ($this->fallbackDirsPsr4 as $dir) { | 
| 364 | -            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { | |
| 364 | +            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { | |
| 365 | 365 | return $file; | 
| 366 | 366 | } | 
| 367 | 367 | } | 
| @@ -373,14 +373,14 @@ discard block | ||
| 373 | 373 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); | 
| 374 | 374 |          } else { | 
| 375 | 375 | // PEAR-like class name | 
| 376 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; | |
| 376 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; | |
| 377 | 377 | } | 
| 378 | 378 | |
| 379 | -        if (isset($this->prefixesPsr0[$first])) { | |
| 380 | -            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { | |
| 379 | +        if (isset($this->prefixesPsr0[ $first ])) { | |
| 380 | +            foreach ($this->prefixesPsr0[ $first ] as $prefix => $dirs) { | |
| 381 | 381 |                  if (0 === strpos($class, $prefix)) { | 
| 382 | 382 |                      foreach ($dirs as $dir) { | 
| 383 | -                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { | |
| 383 | +                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { | |
| 384 | 384 | return $file; | 
| 385 | 385 | } | 
| 386 | 386 | } | 
| @@ -390,7 +390,7 @@ discard block | ||
| 390 | 390 | |
| 391 | 391 | // PSR-0 fallback dirs | 
| 392 | 392 |          foreach ($this->fallbackDirsPsr0 as $dir) { | 
| 393 | -            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { | |
| 393 | +            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { | |
| 394 | 394 | return $file; | 
| 395 | 395 | } | 
| 396 | 396 | } | 
| @@ -6,24 +6,24 @@ | ||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitb90bf1d271f3139658812a290f5c564b | 
| 8 | 8 |  { | 
| 9 | - public static $prefixLengthsPsr4 = array ( | |
| 9 | + public static $prefixLengthsPsr4 = array( | |
| 10 | 10 | 'A' => | 
| 11 | - array ( | |
| 11 | + array( | |
| 12 | 12 | 'Anetwork\\Respond\\' => 17, | 
| 13 | 13 | ), | 
| 14 | 14 | ); | 
| 15 | 15 | |
| 16 | - public static $prefixDirsPsr4 = array ( | |
| 16 | + public static $prefixDirsPsr4 = array( | |
| 17 | 17 | 'Anetwork\\Respond\\' => | 
| 18 | - array ( | |
| 19 | - 0 => __DIR__ . '/../..' . '/src', | |
| 20 | - 1 => __DIR__ . '/../..' . '/tests', | |
| 18 | + array( | |
| 19 | + 0 => __DIR__.'/../..'.'/src', | |
| 20 | + 1 => __DIR__.'/../..'.'/tests', | |
| 21 | 21 | ), | 
| 22 | 22 | ); | 
| 23 | 23 | |
| 24 | 24 | public static function getInitializer(ClassLoader $loader) | 
| 25 | 25 |      { | 
| 26 | -        return \Closure::bind(function () use ($loader) { | |
| 26 | +        return \Closure::bind(function() use ($loader) { | |
| 27 | 27 | $loader->prefixLengthsPsr4 = ComposerStaticInitb90bf1d271f3139658812a290f5c564b::$prefixLengthsPsr4; | 
| 28 | 28 | $loader->prefixDirsPsr4 = ComposerStaticInitb90bf1d271f3139658812a290f5c564b::$prefixDirsPsr4; | 
| 29 | 29 | |
| @@ -6,5 +6,5 @@ | ||
| 6 | 6 | $baseDir = dirname($vendorDir); | 
| 7 | 7 | |
| 8 | 8 | return array( | 
| 9 | - 'Anetwork\\Respond\\' => array($baseDir . '/src', $baseDir . '/tests'), | |
| 9 | + 'Anetwork\\Respond\\' => array($baseDir.'/src', $baseDir.'/tests'), | |
| 10 | 10 | ); | 
| @@ -9,7 +9,7 @@ discard block | ||
| 9 | 9 | public static function loadClassLoader($class) | 
| 10 | 10 |      { | 
| 11 | 11 |          if ('Composer\Autoload\ClassLoader' === $class) { | 
| 12 | - require __DIR__ . '/ClassLoader.php'; | |
| 12 | + require __DIR__.'/ClassLoader.php'; | |
| 13 | 13 | } | 
| 14 | 14 | } | 
| 15 | 15 | |
| @@ -25,21 +25,21 @@ discard block | ||
| 25 | 25 | |
| 26 | 26 |          $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); | 
| 27 | 27 |          if ($useStaticLoader) { | 
| 28 | - require_once __DIR__ . '/autoload_static.php'; | |
| 28 | + require_once __DIR__.'/autoload_static.php'; | |
| 29 | 29 | |
| 30 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInitb90bf1d271f3139658812a290f5c564b::getInitializer($loader)); | 
| 31 | 31 |          } else { | 
| 32 | - $map = require __DIR__ . '/autoload_namespaces.php'; | |
| 32 | + $map = require __DIR__.'/autoload_namespaces.php'; | |
| 33 | 33 |              foreach ($map as $namespace => $path) { | 
| 34 | 34 | $loader->set($namespace, $path); | 
| 35 | 35 | } | 
| 36 | 36 | |
| 37 | - $map = require __DIR__ . '/autoload_psr4.php'; | |
| 37 | + $map = require __DIR__.'/autoload_psr4.php'; | |
| 38 | 38 |              foreach ($map as $namespace => $path) { | 
| 39 | 39 | $loader->setPsr4($namespace, $path); | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | - $classMap = require __DIR__ . '/autoload_classmap.php'; | |
| 42 | + $classMap = require __DIR__.'/autoload_classmap.php'; | |
| 43 | 43 |              if ($classMap) { | 
| 44 | 44 | $loader->addClassMap($classMap); | 
| 45 | 45 | } | 
| @@ -2,6 +2,6 @@ | ||
| 2 | 2 | |
| 3 | 3 | // autoload.php @generated by Composer | 
| 4 | 4 | |
| 5 | -require_once __DIR__ . '/composer' . '/autoload_real.php'; | |
| 5 | +require_once __DIR__.'/composer'.'/autoload_real.php'; | |
| 6 | 6 | |
| 7 | 7 | return ComposerAutoloaderInitb90bf1d271f3139658812a290f5c564b::getLoader(); | 
| @@ -6,44 +6,44 @@ | ||
| 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 | } | 
| @@ -17,7 +17,7 @@ discard block | ||
| 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 | ||
| 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 | |
| @@ -133,7 +133,6 @@ discard block | ||
| 133 | 133 | /** | 
| 134 | 134 | * Database connection is refused | 
| 135 | 135 | * @author Shima Payro <[email protected]> | 
| 136 | - * @param String $message | |
| 137 | 136 | * @since May 2, 2016 9:54:45 AM | 
| 138 | 137 | * @uses | 
| 139 | 138 | * @see | 
| @@ -150,7 +149,6 @@ discard block | ||
| 150 | 149 | /** | 
| 151 | 150 | * page requested is not found | 
| 152 | 151 | * @author Shima Payro <[email protected]> | 
| 153 | - * @param String $message | |
| 154 | 152 | * @since May 2, 2016 9:55:20 AM | 
| 155 | 153 | * @uses | 
| 156 | 154 | * @see | 
| @@ -167,7 +165,6 @@ discard block | ||
| 167 | 165 | /** | 
| 168 | 166 | * Wrong parameters are entered | 
| 169 | 167 | * @author Shima Payro <[email protected]> | 
| 170 | - * @param String $message | |
| 171 | 168 | * @since May 2, 2016 9:55:20 AM | 
| 172 | 169 | * @uses | 
| 173 | 170 | * @see | 
| @@ -184,7 +181,6 @@ discard block | ||
| 184 | 181 | /** | 
| 185 | 182 | * Method is not allowed | 
| 186 | 183 | * @author Shima Payro <[email protected]> | 
| 187 | - * @param String $message | |
| 188 | 184 | * @since May 2, 2016 9:55:20 AM | 
| 189 | 185 | * @uses | 
| 190 | 186 | * @see | 
| @@ -218,7 +214,6 @@ discard block | ||
| 218 | 214 | /** | 
| 219 | 215 | * The request field is not found | 
| 220 | 216 | * @author Shima Payro <[email protected]> | 
| 221 | - * @param String $message | |
| 222 | 217 | * @since May 2, 2016 9:55:20 AM | 
| 223 | 218 | * @uses | 
| 224 | 219 | * @see | 
| @@ -32,8 +32,9 @@ discard block | ||
| 32 | 32 | */ | 
| 33 | 33 |  	public function deleteSucceeded( $message = null ) { | 
| 34 | 34 | |
| 35 | - if ( is_null( $message ) ) | |
| 36 | - $message = $this->config[ 'success' ][ 'delete' ]; | |
| 35 | +		if ( is_null( $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 | ||
| 51 | 52 | */ | 
| 52 | 53 |  	public function updateSucceeded( $message = null ) { | 
| 53 | 54 | |
| 54 | - if ( is_null( $message ) ) | |
| 55 | - $message = $this->config[ 'success' ][ 'update' ]; | |
| 55 | +		if ( is_null( $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 | ||
| 70 | 72 | */ | 
| 71 | 73 |  	public function insertSucceeded( $message = null ) { | 
| 72 | 74 | |
| 73 | - if ( is_null( $message ) ) | |
| 74 | - $message = $this->config[ 'success' ][ 'insert' ]; | |
| 75 | +		if ( is_null( $message ) ) { | |
| 76 | + $message = $this->config[ 'success' ][ 'insert' ]; | |
| 77 | + } | |
| 75 | 78 | |
| 76 | 79 | return $this->setStatusCode( 200 ) | 
| 77 | 80 | ->setStatusText( 'success' ) | 
| @@ -89,8 +92,9 @@ discard block | ||
| 89 | 92 | */ | 
| 90 | 93 |  	public function deleteFaild( $message = null ) { | 
| 91 | 94 | |
| 92 | - if ( is_null( $message ) ) | |
| 93 | - $message = $this->config[ 'fail' ][ 'delete' ]; | |
| 95 | +		if ( is_null( $message ) ) { | |
| 96 | + $message = $this->config[ 'fail' ][ 'delete' ]; | |
| 97 | + } | |
| 94 | 98 | |
| 95 | 99 | return $this->setStatusCode( 447 ) | 
| 96 | 100 | ->setStatusText( 'fail' ) | 
| @@ -109,8 +113,9 @@ discard block | ||
| 109 | 113 | */ | 
| 110 | 114 |  	public function updateFaild( $message = null ) { | 
| 111 | 115 | |
| 112 | - if ( is_null( $message ) ) | |
| 113 | - $message = $this->config[ 'fail' ][ 'update' ]; | |
| 116 | +		if ( is_null( $message ) ) { | |
| 117 | + $message = $this->config[ 'fail' ][ 'update' ]; | |
| 118 | + } | |
| 114 | 119 | |
| 115 | 120 | return $this->setStatusCode( 449 ) | 
| 116 | 121 | ->setStatusText( 'fail' ) | 
| @@ -129,8 +134,9 @@ discard block | ||
| 129 | 134 | */ | 
| 130 | 135 |  	public function insertFaild( $message = null ) { | 
| 131 | 136 | |
| 132 | - if ( is_null( $message ) ) | |
| 133 | - $message = $this->config[ 'fail' ][ 'insert' ]; | |
| 137 | +		if ( is_null( $message ) ) { | |
| 138 | + $message = $this->config[ 'fail' ][ 'insert' ]; | |
| 139 | + } | |
| 134 | 140 | |
| 135 | 141 | return $this->setStatusCode( 448 ) | 
| 136 | 142 | ->setStatusText( 'fail' ) | 
| @@ -5,271 +5,271 @@ | ||
| 5 | 5 | class Messages extends Main | 
| 6 | 6 |  { | 
| 7 | 7 | |
| 8 | - /** | |
| 9 | - * Request succeeded and contains json result | |
| 10 | - * @param array $data | |
| 11 | - * @author Shima Payro <[email protected]> | |
| 12 | - * @since May 2, 2016 9:50:51 AM | |
| 13 | - * @uses | |
| 14 | - * @see | |
| 15 | - */ | |
| 16 | -	public function succeed( $data ) { | |
| 17 | - | |
| 18 | - return $this->setStatusCode( 200 ) | |
| 19 | - ->setStatusText( 'success' ) | |
| 20 | - ->respondWithResult( $data ); | |
| 21 | - | |
| 22 | - } | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * Delete action is succeed | |
| 26 | - * @author Shima Payro <[email protected]> | |
| 27 | - * @param String $message | |
| 28 | - * @since May 2, 2016 9:52:05 AM | |
| 29 | - * @uses | |
| 30 | - * @see | |
| 31 | - */ | |
| 32 | -	public function deleteSucceeded( $message = null ) { | |
| 33 | - | |
| 34 | - if ( is_null( $message ) ) | |
| 35 | - $message = $this->config[ 'success' ][ 'delete' ]; | |
| 36 | - | |
| 37 | - return $this->setStatusCode( 200 ) | |
| 38 | - ->setStatusText( 'success' ) | |
| 39 | - ->respondWithMessage( $message ); | |
| 40 | - | |
| 41 | - } | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * Update action is succeed | |
| 45 | - * @author Shima Payro <[email protected]> | |
| 46 | - * @param String $message | |
| 47 | - * @since May 2, 2016 9:52:52 AM | |
| 48 | - * @uses | |
| 49 | - * @see | |
| 50 | - */ | |
| 51 | -	public function updateSucceeded( $message = null ) { | |
| 52 | - | |
| 53 | - if ( is_null( $message ) ) | |
| 54 | - $message = $this->config[ 'success' ][ 'update' ]; | |
| 55 | - | |
| 56 | - return $this->setStatusCode( 200 ) | |
| 57 | - ->setStatusText( 'success' ) | |
| 58 | - ->respondWithMessage( $message ); | |
| 59 | - | |
| 60 | - } | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * Insert action is succeed | |
| 64 | - * @author Shima Payro <[email protected]> | |
| 65 | - * @param String $message | |
| 66 | - * @since May 2, 2016 9:53:26 AM | |
| 67 | - * @uses | |
| 68 | - * @see | |
| 69 | - */ | |
| 70 | -	public function insertSucceeded( $message = null ) { | |
| 71 | - | |
| 72 | - if ( is_null( $message ) ) | |
| 73 | - $message = $this->config[ 'success' ][ 'insert' ]; | |
| 74 | - | |
| 75 | - return $this->setStatusCode( 200 ) | |
| 76 | - ->setStatusText( 'success' ) | |
| 77 | - ->respondWithMessage( $message ); | |
| 78 | - | |
| 79 | - } | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * Delete action is faild | |
| 83 | - * @author Shima Payro <[email protected]> | |
| 84 | - * @param String $message | |
| 85 | - * @since May 2, 2016 9:53:53 AM | |
| 86 | - * @uses | |
| 87 | - * @see | |
| 88 | - */ | |
| 89 | -	public function deleteFaild( $message = null ) { | |
| 90 | - | |
| 91 | - if ( is_null( $message ) ) | |
| 92 | - $message = $this->config[ 'fail' ][ 'delete' ]; | |
| 93 | - | |
| 94 | - return $this->setStatusCode( 447 ) | |
| 95 | - ->setStatusText( 'fail' ) | |
| 96 | - ->setErrorCode( 5447 ) | |
| 97 | - ->respondWithMessage( $message ); | |
| 98 | - | |
| 99 | - } | |
| 100 | - | |
| 101 | - /** | |
| 102 | - * Update action is succeed | |
| 103 | - * @author Shima Payro <[email protected]> | |
| 104 | - * @param String $message | |
| 105 | - * @since May 2, 2016 9:54:09 AM | |
| 106 | - * @uses | |
| 107 | - * @see | |
| 108 | - */ | |
| 109 | -	public function updateFaild( $message = null ) { | |
| 110 | - | |
| 111 | - if ( is_null( $message ) ) | |
| 112 | - $message = $this->config[ 'fail' ][ 'update' ]; | |
| 113 | - | |
| 114 | - return $this->setStatusCode( 449 ) | |
| 115 | - ->setStatusText( 'fail' ) | |
| 116 | - ->setErrorCode( 5449 ) | |
| 117 | - ->respondWithMessage( $message ); | |
| 118 | - | |
| 119 | - } | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * Insert action is faild | |
| 123 | - * @author Shima Payro <[email protected]> | |
| 124 | - * @param String $message | |
| 125 | - * @since May 2, 2016 9:54:27 AM | |
| 126 | - * @uses | |
| 127 | - * @see | |
| 128 | - */ | |
| 129 | -	public function insertFaild( $message = null ) { | |
| 130 | - | |
| 131 | - if ( is_null( $message ) ) | |
| 132 | - $message = $this->config[ 'fail' ][ 'insert' ]; | |
| 133 | - | |
| 134 | - return $this->setStatusCode( 448 ) | |
| 135 | - ->setStatusText( 'fail' ) | |
| 136 | - ->setErrorCode( 5448 ) | |
| 137 | - ->respondWithMessage( $message ); | |
| 138 | - | |
| 139 | - } | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * Database connection is refused | |
| 143 | - * @author Shima Payro <[email protected]> | |
| 144 | - * @param String $message | |
| 145 | - * @since May 2, 2016 9:54:45 AM | |
| 146 | - * @uses | |
| 147 | - * @see | |
| 148 | - */ | |
| 149 | -	public function connectionRefused() { | |
| 150 | - | |
| 151 | - return $this->setStatusCode( 445 ) | |
| 152 | - ->setStatusText( 'fail' ) | |
| 153 | - ->setErrorCode( 5445 ) | |
| 154 | - ->respondWithMessage(); | |
| 155 | - | |
| 156 | - } | |
| 157 | - | |
| 158 | - /** | |
| 159 | - * page requested is not found | |
| 160 | - * @author Shima Payro <[email protected]> | |
| 161 | - * @param String $message | |
| 162 | - * @since May 2, 2016 9:55:20 AM | |
| 163 | - * @uses | |
| 164 | - * @see | |
| 165 | - */ | |
| 166 | -	public function notFound() { | |
| 167 | - | |
| 168 | - return $this->setStatusCode( 404 ) | |
| 169 | - ->setStatusText( 'fail' ) | |
| 170 | - ->setErrorCode( 5404 ) | |
| 171 | - ->respondWithMessage(); | |
| 172 | - | |
| 173 | - } | |
| 174 | - | |
| 175 | - /** | |
| 176 | - * Wrong parameters are entered | |
| 177 | - * @author Shima Payro <[email protected]> | |
| 178 | - * @param String $message | |
| 179 | - * @since May 2, 2016 9:55:20 AM | |
| 180 | - * @uses | |
| 181 | - * @see | |
| 182 | - */ | |
| 183 | -	public function wrongParameters() { | |
| 184 | - | |
| 185 | - return $this->setStatusCode( 406 ) | |
| 186 | - ->setStatusText( 'fail' ) | |
| 187 | - ->setErrorCode( 5406 ) | |
| 188 | - ->respondWithMessage(); | |
| 189 | - | |
| 190 | - } | |
| 191 | - | |
| 192 | - /** | |
| 193 | - * Method is not allowed | |
| 194 | - * @author Shima Payro <[email protected]> | |
| 195 | - * @param String $message | |
| 196 | - * @since May 2, 2016 9:55:20 AM | |
| 197 | - * @uses | |
| 198 | - * @see | |
| 199 | - */ | |
| 200 | -	public function methodNotAllowed() { | |
| 201 | - | |
| 202 | - return $this->setStatusCode( 405 ) | |
| 203 | - ->setStatusText( 'fail' ) | |
| 204 | - ->setErrorCode( 5405 ) | |
| 205 | - ->respondWithMessage(); | |
| 206 | - | |
| 207 | - } | |
| 208 | - | |
| 209 | - /** | |
| 210 | - * There ara validation errors | |
| 211 | - * @author Shima Payro <[email protected]> | |
| 212 | - * @param $data array | |
| 213 | - * @since May 2, 2016 9:55:20 AM | |
| 214 | - * @uses | |
| 215 | - * @see | |
| 216 | - */ | |
| 217 | -	public function validationErrors( $message = null ) { | |
| 218 | - | |
| 219 | - return $this->setStatusCode( 420 ) | |
| 220 | - ->setStatusText( 'fail' ) | |
| 221 | - ->setErrorCode( 5420 ) | |
| 222 | - ->respondWithResult( $message ); | |
| 223 | - | |
| 224 | - } | |
| 225 | - | |
| 226 | - /** | |
| 227 | - * The request field is not found | |
| 228 | - * @author Shima Payro <[email protected]> | |
| 229 | - * @param String $message | |
| 230 | - * @since May 2, 2016 9:55:20 AM | |
| 231 | - * @uses | |
| 232 | - * @see | |
| 233 | - */ | |
| 234 | -	public function requestFieldNotFound() { | |
| 235 | - | |
| 236 | - return $this->setStatusCode( 446 ) | |
| 237 | - ->setStatusText( 'fail' ) | |
| 238 | - ->setErrorCode( 1001 ) | |
| 239 | - ->respondWithMessage(); | |
| 240 | - | |
| 241 | - } | |
| 242 | - | |
| 243 | - /** | |
| 244 | - * The request field is doublicated | |
| 245 | - * @author Mehdi Hosseini <[email protected]> | |
| 246 | - * @since August 24, 2016 | |
| 247 | - * @return mixed | |
| 248 | - */ | |
| 249 | -	public function requestFieldDuplicated() { | |
| 250 | - | |
| 251 | - return $this->setStatusCode( 400 ) | |
| 252 | - ->setStatusText( 'fail' ) | |
| 253 | - ->SetErrorCode(1004) | |
| 254 | - ->respondWithMessage(); | |
| 255 | - | |
| 256 | - } | |
| 257 | - | |
| 258 | - /** | |
| 259 | - * Custom error message according to error config file | |
| 260 | - * @author Mehdi Hosseini <[email protected]> | |
| 261 | - * @since August 24, 2016 | |
| 262 | - * @param $code integer | |
| 263 | - * @return mixed | |
| 264 | - */ | |
| 265 | -	public function error( $code ) { | |
| 266 | - | |
| 267 | - return $this->setStatusCode( 400 ) | |
| 268 | - ->setStatusText( 'fail' ) | |
| 269 | - ->setErrorCode( $code ) | |
| 270 | - ->respondWithMessage(); | |
| 271 | - | |
| 272 | - } | |
| 8 | + /** | |
| 9 | + * Request succeeded and contains json result | |
| 10 | + * @param array $data | |
| 11 | + * @author Shima Payro <[email protected]> | |
| 12 | + * @since May 2, 2016 9:50:51 AM | |
| 13 | + * @uses | |
| 14 | + * @see | |
| 15 | + */ | |
| 16 | + public function succeed( $data ) { | |
| 17 | + | |
| 18 | + return $this->setStatusCode( 200 ) | |
| 19 | + ->setStatusText( 'success' ) | |
| 20 | + ->respondWithResult( $data ); | |
| 21 | + | |
| 22 | + } | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * Delete action is succeed | |
| 26 | + * @author Shima Payro <[email protected]> | |
| 27 | + * @param String $message | |
| 28 | + * @since May 2, 2016 9:52:05 AM | |
| 29 | + * @uses | |
| 30 | + * @see | |
| 31 | + */ | |
| 32 | + public function deleteSucceeded( $message = null ) { | |
| 33 | + | |
| 34 | + if ( is_null( $message ) ) | |
| 35 | + $message = $this->config[ 'success' ][ 'delete' ]; | |
| 36 | + | |
| 37 | + return $this->setStatusCode( 200 ) | |
| 38 | + ->setStatusText( 'success' ) | |
| 39 | + ->respondWithMessage( $message ); | |
| 40 | + | |
| 41 | + } | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * Update action is succeed | |
| 45 | + * @author Shima Payro <[email protected]> | |
| 46 | + * @param String $message | |
| 47 | + * @since May 2, 2016 9:52:52 AM | |
| 48 | + * @uses | |
| 49 | + * @see | |
| 50 | + */ | |
| 51 | + public function updateSucceeded( $message = null ) { | |
| 52 | + | |
| 53 | + if ( is_null( $message ) ) | |
| 54 | + $message = $this->config[ 'success' ][ 'update' ]; | |
| 55 | + | |
| 56 | + return $this->setStatusCode( 200 ) | |
| 57 | + ->setStatusText( 'success' ) | |
| 58 | + ->respondWithMessage( $message ); | |
| 59 | + | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Insert action is succeed | |
| 64 | + * @author Shima Payro <[email protected]> | |
| 65 | + * @param String $message | |
| 66 | + * @since May 2, 2016 9:53:26 AM | |
| 67 | + * @uses | |
| 68 | + * @see | |
| 69 | + */ | |
| 70 | + public function insertSucceeded( $message = null ) { | |
| 71 | + | |
| 72 | + if ( is_null( $message ) ) | |
| 73 | + $message = $this->config[ 'success' ][ 'insert' ]; | |
| 74 | + | |
| 75 | + return $this->setStatusCode( 200 ) | |
| 76 | + ->setStatusText( 'success' ) | |
| 77 | + ->respondWithMessage( $message ); | |
| 78 | + | |
| 79 | + } | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * Delete action is faild | |
| 83 | + * @author Shima Payro <[email protected]> | |
| 84 | + * @param String $message | |
| 85 | + * @since May 2, 2016 9:53:53 AM | |
| 86 | + * @uses | |
| 87 | + * @see | |
| 88 | + */ | |
| 89 | + public function deleteFaild( $message = null ) { | |
| 90 | + | |
| 91 | + if ( is_null( $message ) ) | |
| 92 | + $message = $this->config[ 'fail' ][ 'delete' ]; | |
| 93 | + | |
| 94 | + return $this->setStatusCode( 447 ) | |
| 95 | + ->setStatusText( 'fail' ) | |
| 96 | + ->setErrorCode( 5447 ) | |
| 97 | + ->respondWithMessage( $message ); | |
| 98 | + | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Update action is succeed | |
| 103 | + * @author Shima Payro <[email protected]> | |
| 104 | + * @param String $message | |
| 105 | + * @since May 2, 2016 9:54:09 AM | |
| 106 | + * @uses | |
| 107 | + * @see | |
| 108 | + */ | |
| 109 | + public function updateFaild( $message = null ) { | |
| 110 | + | |
| 111 | + if ( is_null( $message ) ) | |
| 112 | + $message = $this->config[ 'fail' ][ 'update' ]; | |
| 113 | + | |
| 114 | + return $this->setStatusCode( 449 ) | |
| 115 | + ->setStatusText( 'fail' ) | |
| 116 | + ->setErrorCode( 5449 ) | |
| 117 | + ->respondWithMessage( $message ); | |
| 118 | + | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * Insert action is faild | |
| 123 | + * @author Shima Payro <[email protected]> | |
| 124 | + * @param String $message | |
| 125 | + * @since May 2, 2016 9:54:27 AM | |
| 126 | + * @uses | |
| 127 | + * @see | |
| 128 | + */ | |
| 129 | + public function insertFaild( $message = null ) { | |
| 130 | + | |
| 131 | + if ( is_null( $message ) ) | |
| 132 | + $message = $this->config[ 'fail' ][ 'insert' ]; | |
| 133 | + | |
| 134 | + return $this->setStatusCode( 448 ) | |
| 135 | + ->setStatusText( 'fail' ) | |
| 136 | + ->setErrorCode( 5448 ) | |
| 137 | + ->respondWithMessage( $message ); | |
| 138 | + | |
| 139 | + } | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * Database connection is refused | |
| 143 | + * @author Shima Payro <[email protected]> | |
| 144 | + * @param String $message | |
| 145 | + * @since May 2, 2016 9:54:45 AM | |
| 146 | + * @uses | |
| 147 | + * @see | |
| 148 | + */ | |
| 149 | + public function connectionRefused() { | |
| 150 | + | |
| 151 | + return $this->setStatusCode( 445 ) | |
| 152 | + ->setStatusText( 'fail' ) | |
| 153 | + ->setErrorCode( 5445 ) | |
| 154 | + ->respondWithMessage(); | |
| 155 | + | |
| 156 | + } | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * page requested is not found | |
| 160 | + * @author Shima Payro <[email protected]> | |
| 161 | + * @param String $message | |
| 162 | + * @since May 2, 2016 9:55:20 AM | |
| 163 | + * @uses | |
| 164 | + * @see | |
| 165 | + */ | |
| 166 | + public function notFound() { | |
| 167 | + | |
| 168 | + return $this->setStatusCode( 404 ) | |
| 169 | + ->setStatusText( 'fail' ) | |
| 170 | + ->setErrorCode( 5404 ) | |
| 171 | + ->respondWithMessage(); | |
| 172 | + | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * Wrong parameters are entered | |
| 177 | + * @author Shima Payro <[email protected]> | |
| 178 | + * @param String $message | |
| 179 | + * @since May 2, 2016 9:55:20 AM | |
| 180 | + * @uses | |
| 181 | + * @see | |
| 182 | + */ | |
| 183 | + public function wrongParameters() { | |
| 184 | + | |
| 185 | + return $this->setStatusCode( 406 ) | |
| 186 | + ->setStatusText( 'fail' ) | |
| 187 | + ->setErrorCode( 5406 ) | |
| 188 | + ->respondWithMessage(); | |
| 189 | + | |
| 190 | + } | |
| 191 | + | |
| 192 | + /** | |
| 193 | + * Method is not allowed | |
| 194 | + * @author Shima Payro <[email protected]> | |
| 195 | + * @param String $message | |
| 196 | + * @since May 2, 2016 9:55:20 AM | |
| 197 | + * @uses | |
| 198 | + * @see | |
| 199 | + */ | |
| 200 | + public function methodNotAllowed() { | |
| 201 | + | |
| 202 | + return $this->setStatusCode( 405 ) | |
| 203 | + ->setStatusText( 'fail' ) | |
| 204 | + ->setErrorCode( 5405 ) | |
| 205 | + ->respondWithMessage(); | |
| 206 | + | |
| 207 | + } | |
| 208 | + | |
| 209 | + /** | |
| 210 | + * There ara validation errors | |
| 211 | + * @author Shima Payro <[email protected]> | |
| 212 | + * @param $data array | |
| 213 | + * @since May 2, 2016 9:55:20 AM | |
| 214 | + * @uses | |
| 215 | + * @see | |
| 216 | + */ | |
| 217 | + public function validationErrors( $message = null ) { | |
| 218 | + | |
| 219 | + return $this->setStatusCode( 420 ) | |
| 220 | + ->setStatusText( 'fail' ) | |
| 221 | + ->setErrorCode( 5420 ) | |
| 222 | + ->respondWithResult( $message ); | |
| 223 | + | |
| 224 | + } | |
| 225 | + | |
| 226 | + /** | |
| 227 | + * The request field is not found | |
| 228 | + * @author Shima Payro <[email protected]> | |
| 229 | + * @param String $message | |
| 230 | + * @since May 2, 2016 9:55:20 AM | |
| 231 | + * @uses | |
| 232 | + * @see | |
| 233 | + */ | |
| 234 | + public function requestFieldNotFound() { | |
| 235 | + | |
| 236 | + return $this->setStatusCode( 446 ) | |
| 237 | + ->setStatusText( 'fail' ) | |
| 238 | + ->setErrorCode( 1001 ) | |
| 239 | + ->respondWithMessage(); | |
| 240 | + | |
| 241 | + } | |
| 242 | + | |
| 243 | + /** | |
| 244 | + * The request field is doublicated | |
| 245 | + * @author Mehdi Hosseini <[email protected]> | |
| 246 | + * @since August 24, 2016 | |
| 247 | + * @return mixed | |
| 248 | + */ | |
| 249 | + public function requestFieldDuplicated() { | |
| 250 | + | |
| 251 | + return $this->setStatusCode( 400 ) | |
| 252 | + ->setStatusText( 'fail' ) | |
| 253 | + ->SetErrorCode(1004) | |
| 254 | + ->respondWithMessage(); | |
| 255 | + | |
| 256 | + } | |
| 257 | + | |
| 258 | + /** | |
| 259 | + * Custom error message according to error config file | |
| 260 | + * @author Mehdi Hosseini <[email protected]> | |
| 261 | + * @since August 24, 2016 | |
| 262 | + * @param $code integer | |
| 263 | + * @return mixed | |
| 264 | + */ | |
| 265 | + public function error( $code ) { | |
| 266 | + | |
| 267 | + return $this->setStatusCode( 400 ) | |
| 268 | + ->setStatusText( 'fail' ) | |
| 269 | + ->setErrorCode( $code ) | |
| 270 | + ->respondWithMessage(); | |
| 271 | + | |
| 272 | + } | |
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | } | 
| @@ -13,11 +13,11 @@ discard block | ||
| 13 | 13 | * @uses | 
| 14 | 14 | * @see | 
| 15 | 15 | */ | 
| 16 | -	public function succeed( $data ) { | |
| 16 | +	public function succeed($data) { | |
| 17 | 17 | |
| 18 | - return $this->setStatusCode( 200 ) | |
| 19 | - ->setStatusText( 'success' ) | |
| 20 | - ->respondWithResult( $data ); | |
| 18 | + return $this->setStatusCode(200) | |
| 19 | +					->setStatusText('success') | |
| 20 | + ->respondWithResult($data); | |
| 21 | 21 | |
| 22 | 22 | } | 
| 23 | 23 | |
| @@ -29,14 +29,14 @@ discard block | ||
| 29 | 29 | * @uses | 
| 30 | 30 | * @see | 
| 31 | 31 | */ | 
| 32 | -	public function deleteSucceeded( $message = null ) { | |
| 32 | +	public function deleteSucceeded($message = null) { | |
| 33 | 33 | |
| 34 | - if ( is_null( $message ) ) | |
| 34 | + if (is_null($message)) | |
| 35 | 35 | $message = $this->config[ 'success' ][ 'delete' ]; | 
| 36 | 36 | |
| 37 | - return $this->setStatusCode( 200 ) | |
| 38 | - ->setStatusText( 'success' ) | |
| 39 | - ->respondWithMessage( $message ); | |
| 37 | + return $this->setStatusCode(200) | |
| 38 | +					->setStatusText('success') | |
| 39 | + ->respondWithMessage($message); | |
| 40 | 40 | |
| 41 | 41 | } | 
| 42 | 42 | |
| @@ -48,14 +48,14 @@ discard block | ||
| 48 | 48 | * @uses | 
| 49 | 49 | * @see | 
| 50 | 50 | */ | 
| 51 | -	public function updateSucceeded( $message = null ) { | |
| 51 | +	public function updateSucceeded($message = null) { | |
| 52 | 52 | |
| 53 | - if ( is_null( $message ) ) | |
| 53 | + if (is_null($message)) | |
| 54 | 54 | $message = $this->config[ 'success' ][ 'update' ]; | 
| 55 | 55 | |
| 56 | - return $this->setStatusCode( 200 ) | |
| 57 | - ->setStatusText( 'success' ) | |
| 58 | - ->respondWithMessage( $message ); | |
| 56 | + return $this->setStatusCode(200) | |
| 57 | +					->setStatusText('success') | |
| 58 | + ->respondWithMessage($message); | |
| 59 | 59 | |
| 60 | 60 | } | 
| 61 | 61 | |
| @@ -67,14 +67,14 @@ discard block | ||
| 67 | 67 | * @uses | 
| 68 | 68 | * @see | 
| 69 | 69 | */ | 
| 70 | -	public function insertSucceeded( $message = null ) { | |
| 70 | +	public function insertSucceeded($message = null) { | |
| 71 | 71 | |
| 72 | - if ( is_null( $message ) ) | |
| 72 | + if (is_null($message)) | |
| 73 | 73 | $message = $this->config[ 'success' ][ 'insert' ]; | 
| 74 | 74 | |
| 75 | - return $this->setStatusCode( 200 ) | |
| 76 | - ->setStatusText( 'success' ) | |
| 77 | - ->respondWithMessage( $message ); | |
| 75 | + return $this->setStatusCode(200) | |
| 76 | +					->setStatusText('success') | |
| 77 | + ->respondWithMessage($message); | |
| 78 | 78 | |
| 79 | 79 | } | 
| 80 | 80 | |
| @@ -86,15 +86,15 @@ discard block | ||
| 86 | 86 | * @uses | 
| 87 | 87 | * @see | 
| 88 | 88 | */ | 
| 89 | -	public function deleteFaild( $message = null ) { | |
| 89 | +	public function deleteFaild($message = null) { | |
| 90 | 90 | |
| 91 | - if ( is_null( $message ) ) | |
| 91 | + if (is_null($message)) | |
| 92 | 92 | $message = $this->config[ 'fail' ][ 'delete' ]; | 
| 93 | 93 | |
| 94 | - return $this->setStatusCode( 447 ) | |
| 95 | - ->setStatusText( 'fail' ) | |
| 96 | - ->setErrorCode( 5447 ) | |
| 97 | - ->respondWithMessage( $message ); | |
| 94 | + return $this->setStatusCode(447) | |
| 95 | +					->setStatusText('fail') | |
| 96 | + ->setErrorCode(5447) | |
| 97 | + ->respondWithMessage($message); | |
| 98 | 98 | |
| 99 | 99 | } | 
| 100 | 100 | |
| @@ -106,15 +106,15 @@ discard block | ||
| 106 | 106 | * @uses | 
| 107 | 107 | * @see | 
| 108 | 108 | */ | 
| 109 | -	public function updateFaild( $message = null ) { | |
| 109 | +	public function updateFaild($message = null) { | |
| 110 | 110 | |
| 111 | - if ( is_null( $message ) ) | |
| 111 | + if (is_null($message)) | |
| 112 | 112 | $message = $this->config[ 'fail' ][ 'update' ]; | 
| 113 | 113 | |
| 114 | - return $this->setStatusCode( 449 ) | |
| 115 | - ->setStatusText( 'fail' ) | |
| 116 | - ->setErrorCode( 5449 ) | |
| 117 | - ->respondWithMessage( $message ); | |
| 114 | + return $this->setStatusCode(449) | |
| 115 | +					->setStatusText('fail') | |
| 116 | + ->setErrorCode(5449) | |
| 117 | + ->respondWithMessage($message); | |
| 118 | 118 | |
| 119 | 119 | } | 
| 120 | 120 | |
| @@ -126,15 +126,15 @@ discard block | ||
| 126 | 126 | * @uses | 
| 127 | 127 | * @see | 
| 128 | 128 | */ | 
| 129 | -	public function insertFaild( $message = null ) { | |
| 129 | +	public function insertFaild($message = null) { | |
| 130 | 130 | |
| 131 | - if ( is_null( $message ) ) | |
| 131 | + if (is_null($message)) | |
| 132 | 132 | $message = $this->config[ 'fail' ][ 'insert' ]; | 
| 133 | 133 | |
| 134 | - return $this->setStatusCode( 448 ) | |
| 135 | - ->setStatusText( 'fail' ) | |
| 136 | - ->setErrorCode( 5448 ) | |
| 137 | - ->respondWithMessage( $message ); | |
| 134 | + return $this->setStatusCode(448) | |
| 135 | +					->setStatusText('fail') | |
| 136 | + ->setErrorCode(5448) | |
| 137 | + ->respondWithMessage($message); | |
| 138 | 138 | |
| 139 | 139 | } | 
| 140 | 140 | |
| @@ -148,9 +148,9 @@ discard block | ||
| 148 | 148 | */ | 
| 149 | 149 |  	public function connectionRefused() { | 
| 150 | 150 | |
| 151 | - return $this->setStatusCode( 445 ) | |
| 152 | - ->setStatusText( 'fail' ) | |
| 153 | - ->setErrorCode( 5445 ) | |
| 151 | + return $this->setStatusCode(445) | |
| 152 | +					->setStatusText('fail') | |
| 153 | + ->setErrorCode(5445) | |
| 154 | 154 | ->respondWithMessage(); | 
| 155 | 155 | |
| 156 | 156 | } | 
| @@ -165,9 +165,9 @@ discard block | ||
| 165 | 165 | */ | 
| 166 | 166 |  	public function notFound() { | 
| 167 | 167 | |
| 168 | - return $this->setStatusCode( 404 ) | |
| 169 | - ->setStatusText( 'fail' ) | |
| 170 | - ->setErrorCode( 5404 ) | |
| 168 | + return $this->setStatusCode(404) | |
| 169 | +					->setStatusText('fail') | |
| 170 | + ->setErrorCode(5404) | |
| 171 | 171 | ->respondWithMessage(); | 
| 172 | 172 | |
| 173 | 173 | } | 
| @@ -182,9 +182,9 @@ discard block | ||
| 182 | 182 | */ | 
| 183 | 183 |  	public function wrongParameters() { | 
| 184 | 184 | |
| 185 | - return $this->setStatusCode( 406 ) | |
| 186 | - ->setStatusText( 'fail' ) | |
| 187 | - ->setErrorCode( 5406 ) | |
| 185 | + return $this->setStatusCode(406) | |
| 186 | +					->setStatusText('fail') | |
| 187 | + ->setErrorCode(5406) | |
| 188 | 188 | ->respondWithMessage(); | 
| 189 | 189 | |
| 190 | 190 | } | 
| @@ -199,9 +199,9 @@ discard block | ||
| 199 | 199 | */ | 
| 200 | 200 |  	public function methodNotAllowed() { | 
| 201 | 201 | |
| 202 | - return $this->setStatusCode( 405 ) | |
| 203 | - ->setStatusText( 'fail' ) | |
| 204 | - ->setErrorCode( 5405 ) | |
| 202 | + return $this->setStatusCode(405) | |
| 203 | +					->setStatusText('fail') | |
| 204 | + ->setErrorCode(5405) | |
| 205 | 205 | ->respondWithMessage(); | 
| 206 | 206 | |
| 207 | 207 | } | 
| @@ -214,12 +214,12 @@ discard block | ||
| 214 | 214 | * @uses | 
| 215 | 215 | * @see | 
| 216 | 216 | */ | 
| 217 | -	public function validationErrors( $message = null ) { | |
| 217 | +	public function validationErrors($message = null) { | |
| 218 | 218 | |
| 219 | - return $this->setStatusCode( 420 ) | |
| 220 | - ->setStatusText( 'fail' ) | |
| 221 | - ->setErrorCode( 5420 ) | |
| 222 | - ->respondWithResult( $message ); | |
| 219 | + return $this->setStatusCode(420) | |
| 220 | +					->setStatusText('fail') | |
| 221 | + ->setErrorCode(5420) | |
| 222 | + ->respondWithResult($message); | |
| 223 | 223 | |
| 224 | 224 | } | 
| 225 | 225 | |
| @@ -233,9 +233,9 @@ discard block | ||
| 233 | 233 | */ | 
| 234 | 234 |  	public function requestFieldNotFound() { | 
| 235 | 235 | |
| 236 | - return $this->setStatusCode( 446 ) | |
| 237 | - ->setStatusText( 'fail' ) | |
| 238 | - ->setErrorCode( 1001 ) | |
| 236 | + return $this->setStatusCode(446) | |
| 237 | +					->setStatusText('fail') | |
| 238 | + ->setErrorCode(1001) | |
| 239 | 239 | ->respondWithMessage(); | 
| 240 | 240 | |
| 241 | 241 | } | 
| @@ -248,8 +248,8 @@ discard block | ||
| 248 | 248 | */ | 
| 249 | 249 |  	public function requestFieldDuplicated() { | 
| 250 | 250 | |
| 251 | - return $this->setStatusCode( 400 ) | |
| 252 | - ->setStatusText( 'fail' ) | |
| 251 | + return $this->setStatusCode(400) | |
| 252 | +					->setStatusText('fail') | |
| 253 | 253 | ->SetErrorCode(1004) | 
| 254 | 254 | ->respondWithMessage(); | 
| 255 | 255 | |
| @@ -262,11 +262,11 @@ discard block | ||
| 262 | 262 | * @param $code integer | 
| 263 | 263 | * @return mixed | 
| 264 | 264 | */ | 
| 265 | -	public function error( $code ) { | |
| 265 | +	public function error($code) { | |
| 266 | 266 | |
| 267 | - return $this->setStatusCode( 400 ) | |
| 268 | - ->setStatusText( 'fail' ) | |
| 269 | - ->setErrorCode( $code ) | |
| 267 | + return $this->setStatusCode(400) | |
| 268 | +					->setStatusText('fail') | |
| 269 | + ->setErrorCode($code) | |
| 270 | 270 | ->respondWithMessage(); | 
| 271 | 271 | |
| 272 | 272 | } | 
| @@ -132,8 +132,9 @@ discard block | ||
| 132 | 132 | |
| 133 | 133 | $result = array_filter( $this->getHeaders() ); | 
| 134 | 134 | |
| 135 | - if ( empty( $result ) ) | |
| 136 | - return response()->json( $data, $this->getStatusCode() ); | |
| 135 | +		if ( empty( $result ) ) { | |
| 136 | + return response()->json( $data, $this->getStatusCode() ); | |
| 137 | + } | |
| 137 | 138 | |
| 138 | 139 | return response()->json( $data, $this->getStatusCode() ) | 
| 139 | 140 | ->withHeaders( $this->getHeaders() ); | 
| @@ -158,10 +159,11 @@ discard block | ||
| 158 | 159 | |
| 159 | 160 | $res[ 'error' ] = $this->getErrorCode(); | 
| 160 | 161 | |
| 161 | - if ( is_null( $message ) ) | |
| 162 | - $res[ 'message' ] = $this->getErrorMessage(); | |
| 163 | - else | |
| 164 | - $res[ 'message' ] = $message; | |
| 162 | +			if ( is_null( $message ) ) { | |
| 163 | + $res[ 'message' ] = $this->getErrorMessage(); | |
| 164 | +			} else { | |
| 165 | + $res[ 'message' ] = $message; | |
| 166 | + } | |
| 165 | 167 | |
| 166 | 168 |  		} else { | 
| 167 | 169 | |
| @@ -228,7 +228,7 @@ | ||
| 228 | 228 | * Set headers | 
| 229 | 229 | * @author Shima Payro <[email protected]> | 
| 230 | 230 | * @since Sep 13, 2016 | 
| 231 | - * @return array | |
| 231 | + * @return Main | |
| 232 | 232 | */ | 
| 233 | 233 |  	public function setHeaders( $headers = [] ) { | 
| 234 | 234 | |
| @@ -4,271 +4,271 @@ | ||
| 4 | 4 | |
| 5 | 5 |  class Main { | 
| 6 | 6 | |
| 7 | - /** | |
| 8 | - * Http status code | |
| 9 | - * @var integer | |
| 10 | - */ | |
| 11 | - protected $statusCode = 200; | |
| 12 | - | |
| 13 | - /** | |
| 14 | - * Status text | |
| 15 | - * @var string | |
| 16 | - */ | |
| 17 | - protected $statusText = 'success'; | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * Error code, message and text-key | |
| 21 | - * @var array | |
| 22 | - */ | |
| 23 | - protected $error; | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * Error code | |
| 27 | - * @var integer | |
| 28 | - */ | |
| 29 | - protected $errorCode; | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * Haeders | |
| 33 | - * @var array | |
| 34 | - */ | |
| 35 | - protected $headers = []; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * @var string | |
| 39 | - */ | |
| 40 | - protected $lang; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * @var array | |
| 44 | - */ | |
| 45 | - protected $config; | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * @author Shahrokh Niakan <[email protected]> | |
| 49 | - * @since Sep 24, 2016 | |
| 50 | - */ | |
| 51 | -	public function __construct() { | |
| 52 | - | |
| 53 | - | |
| 54 | - $this->lang = \App::getLocale(); | |
| 55 | - | |
| 56 | -		if(! file_exists(config_path($this->lang . '.php'))){ | |
| 7 | + /** | |
| 8 | + * Http status code | |
| 9 | + * @var integer | |
| 10 | + */ | |
| 11 | + protected $statusCode = 200; | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * Status text | |
| 15 | + * @var string | |
| 16 | + */ | |
| 17 | + protected $statusText = 'success'; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * Error code, message and text-key | |
| 21 | + * @var array | |
| 22 | + */ | |
| 23 | + protected $error; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Error code | |
| 27 | + * @var integer | |
| 28 | + */ | |
| 29 | + protected $errorCode; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * Haeders | |
| 33 | + * @var array | |
| 34 | + */ | |
| 35 | + protected $headers = []; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * @var string | |
| 39 | + */ | |
| 40 | + protected $lang; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * @var array | |
| 44 | + */ | |
| 45 | + protected $config; | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * @author Shahrokh Niakan <[email protected]> | |
| 49 | + * @since Sep 24, 2016 | |
| 50 | + */ | |
| 51 | + public function __construct() { | |
| 52 | + | |
| 53 | + | |
| 54 | + $this->lang = \App::getLocale(); | |
| 55 | + | |
| 56 | +  if(! file_exists(config_path($this->lang . '.php'))){ | |
| 57 | 57 | $this->config = include __DIR__ . '/../errors/lang/' . $this->lang . '.php'; | 
| 58 | 58 |          } else { | 
| 59 | 59 | $this->config = include config_path($this->lang . '.php'); | 
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | - } | |
| 62 | + } | |
| 63 | 63 | |
| 64 | - /** | |
| 65 | - * Getter for $statusCode | |
| 66 | - * @author Shima Payro <[email protected]> | |
| 67 | - * @since May 2, 2016 9:46:27 AM | |
| 68 | - * @uses | |
| 69 | - * @see | |
| 70 | - */ | |
| 71 | -	public function getStatusCode() { | |
| 64 | + /** | |
| 65 | + * Getter for $statusCode | |
| 66 | + * @author Shima Payro <[email protected]> | |
| 67 | + * @since May 2, 2016 9:46:27 AM | |
| 68 | + * @uses | |
| 69 | + * @see | |
| 70 | + */ | |
| 71 | + public function getStatusCode() { | |
| 72 | 72 | |
| 73 | - return $this->statusCode; | |
| 73 | + return $this->statusCode; | |
| 74 | 74 | |
| 75 | - } | |
| 75 | + } | |
| 76 | 76 | |
| 77 | - /** | |
| 78 | - * Setter for $statusCode | |
| 79 | - * @param integer $statusCode | |
| 80 | - * @return $this | |
| 81 | - * @author Shima Payro <[email protected]> | |
| 82 | - * @since May 2, 2016 9:47:04 AM | |
| 83 | - * @uses | |
| 84 | - * @see | |
| 85 | - */ | |
| 86 | -	public function setStatusCode( $statusCode ) { | |
| 77 | + /** | |
| 78 | + * Setter for $statusCode | |
| 79 | + * @param integer $statusCode | |
| 80 | + * @return $this | |
| 81 | + * @author Shima Payro <[email protected]> | |
| 82 | + * @since May 2, 2016 9:47:04 AM | |
| 83 | + * @uses | |
| 84 | + * @see | |
| 85 | + */ | |
| 86 | + public function setStatusCode( $statusCode ) { | |
| 87 | 87 | |
| 88 | - $this->statusCode = $statusCode; | |
| 88 | + $this->statusCode = $statusCode; | |
| 89 | 89 | |
| 90 | - return $this; | |
| 90 | + return $this; | |
| 91 | 91 | |
| 92 | - } | |
| 92 | + } | |
| 93 | 93 | |
| 94 | - /** | |
| 95 | - * Getter for $statusText | |
| 96 | - * @author Shima Payro <[email protected]> | |
| 97 | - * @since May 2, 2016 9:47:36 AM | |
| 98 | - * @uses | |
| 99 | - * @see | |
| 100 | - */ | |
| 101 | -	public function getStatusText() { | |
| 94 | + /** | |
| 95 | + * Getter for $statusText | |
| 96 | + * @author Shima Payro <[email protected]> | |
| 97 | + * @since May 2, 2016 9:47:36 AM | |
| 98 | + * @uses | |
| 99 | + * @see | |
| 100 | + */ | |
| 101 | + public function getStatusText() { | |
| 102 | 102 | |
| 103 | - return $this->statusText; | |
| 103 | + return $this->statusText; | |
| 104 | 104 | |
| 105 | - } | |
| 105 | + } | |
| 106 | 106 | |
| 107 | - /** | |
| 108 | - * Setter for $statusText | |
| 109 | - * @param String $statusText | |
| 110 | - * @return $this | |
| 111 | - * @author Shima Payro <[email protected]> | |
| 112 | - * @since May 2, 2016 9:48:23 AM | |
| 113 | - * @uses | |
| 114 | - * @see | |
| 115 | - */ | |
| 116 | -	public function setStatusText( $statusText ) { | |
| 107 | + /** | |
| 108 | + * Setter for $statusText | |
| 109 | + * @param String $statusText | |
| 110 | + * @return $this | |
| 111 | + * @author Shima Payro <[email protected]> | |
| 112 | + * @since May 2, 2016 9:48:23 AM | |
| 113 | + * @uses | |
| 114 | + * @see | |
| 115 | + */ | |
| 116 | + public function setStatusText( $statusText ) { | |
| 117 | 117 | |
| 118 | - $this->statusText = $statusText; | |
| 118 | + $this->statusText = $statusText; | |
| 119 | 119 | |
| 120 | - return $this; | |
| 120 | + return $this; | |
| 121 | 121 | |
| 122 | - } | |
| 122 | + } | |
| 123 | 123 | |
| 124 | - /** | |
| 125 | - * Response | |
| 126 | - * @param $data : json | |
| 127 | - * @return $this|\Illuminate\Http\JsonResponse | |
| 128 | - * @author Shima Payro <[email protected]> | |
| 129 | - * @since May 2, 2016 9:48:45 AM | |
| 130 | - * @uses | |
| 131 | - * @see | |
| 132 | - */ | |
| 133 | -	public function respond( $data ) { | |
| 124 | + /** | |
| 125 | + * Response | |
| 126 | + * @param $data : json | |
| 127 | + * @return $this|\Illuminate\Http\JsonResponse | |
| 128 | + * @author Shima Payro <[email protected]> | |
| 129 | + * @since May 2, 2016 9:48:45 AM | |
| 130 | + * @uses | |
| 131 | + * @see | |
| 132 | + */ | |
| 133 | + public function respond( $data ) { | |
| 134 | 134 | |
| 135 | - $result = array_filter( $this->getHeaders() ); | |
| 135 | + $result = array_filter( $this->getHeaders() ); | |
| 136 | 136 | |
| 137 | - if ( empty( $result ) ) | |
| 138 | - return response()->json( $data, $this->getStatusCode() ); | |
| 137 | + if ( empty( $result ) ) | |
| 138 | + return response()->json( $data, $this->getStatusCode() ); | |
| 139 | 139 | |
| 140 | - return response()->json( $data, $this->getStatusCode() ) | |
| 141 | - ->withHeaders( $this->getHeaders() ); | |
| 140 | + return response()->json( $data, $this->getStatusCode() ) | |
| 141 | + ->withHeaders( $this->getHeaders() ); | |
| 142 | 142 | |
| 143 | - } | |
| 143 | + } | |
| 144 | 144 | |
| 145 | - /** | |
| 146 | - * Response which conteins just a message | |
| 147 | - * @param string $message | |
| 148 | - * @author Shima Payro <[email protected]> | |
| 149 | - * @since May 2, 2016 9:49:21 AM | |
| 150 | - * @return Main|\Illuminate\Http\JsonResponse | |
| 151 | - * @uses | |
| 152 | - * @see | |
| 153 | - */ | |
| 154 | -	public function respondWithMessage( $message = null ) { | |
| 145 | + /** | |
| 146 | + * Response which conteins just a message | |
| 147 | + * @param string $message | |
| 148 | + * @author Shima Payro <[email protected]> | |
| 149 | + * @since May 2, 2016 9:49:21 AM | |
| 150 | + * @return Main|\Illuminate\Http\JsonResponse | |
| 151 | + * @uses | |
| 152 | + * @see | |
| 153 | + */ | |
| 154 | + public function respondWithMessage( $message = null ) { | |
| 155 | 155 | |
| 156 | - $res[ 'status' ] = $this->getStatusText(); | |
| 156 | + $res[ 'status' ] = $this->getStatusText(); | |
| 157 | 157 | |
| 158 | - //if it's about failure | |
| 159 | -		if ( $this->getErrorCode() ) { | |
| 158 | + //if it's about failure | |
| 159 | +  if ( $this->getErrorCode() ) { | |
| 160 | 160 | |
| 161 | - $res[ 'error' ] = $this->getErrorCode(); | |
| 161 | + $res[ 'error' ] = $this->getErrorCode(); | |
| 162 | 162 | |
| 163 | - if ( is_null( $message ) ) | |
| 164 | - $res[ 'message' ] = $this->getErrorMessage(); | |
| 165 | - else | |
| 166 | - $res[ 'message' ] = $message; | |
| 163 | + if ( is_null( $message ) ) | |
| 164 | + $res[ 'message' ] = $this->getErrorMessage(); | |
| 165 | + else | |
| 166 | + $res[ 'message' ] = $message; | |
| 167 | 167 | |
| 168 | -		} else { | |
| 168 | +  } else { | |
| 169 | 169 | |
| 170 | - $res[ 'message' ] = $message; | |
| 170 | + $res[ 'message' ] = $message; | |
| 171 | 171 | |
| 172 | - } | |
| 172 | + } | |
| 173 | 173 | |
| 174 | - return $this->respond( $res ); | |
| 174 | + return $this->respond( $res ); | |
| 175 | 175 | |
| 176 | - } | |
| 176 | + } | |
| 177 | 177 | |
| 178 | - /** | |
| 179 | - * Set error code in our result | |
| 180 | - * @author Mehdi Hosseini <[email protected]> | |
| 181 | - * @since August 24, 2016 | |
| 182 | - * @param $errorCode integer | |
| 183 | - * @return $this | |
| 184 | - */ | |
| 185 | -	public function setErrorCode( $errorCode ) { | |
| 178 | + /** | |
| 179 | + * Set error code in our result | |
| 180 | + * @author Mehdi Hosseini <[email protected]> | |
| 181 | + * @since August 24, 2016 | |
| 182 | + * @param $errorCode integer | |
| 183 | + * @return $this | |
| 184 | + */ | |
| 185 | + public function setErrorCode( $errorCode ) { | |
| 186 | 186 | |
| 187 | - $this->error = $this->config[ $errorCode ]; | |
| 187 | + $this->error = $this->config[ $errorCode ]; | |
| 188 | 188 | |
| 189 | - $this->errorCode = $errorCode; | |
| 189 | + $this->errorCode = $errorCode; | |
| 190 | 190 | |
| 191 | - return $this; | |
| 191 | + return $this; | |
| 192 | 192 | |
| 193 | - } | |
| 193 | + } | |
| 194 | 194 | |
| 195 | - /** | |
| 196 | - * Return Error code | |
| 197 | - * @author Mehdi Hosseini <[email protected]> | |
| 198 | - * @since August 24, 2016 | |
| 199 | - * @return integer | |
| 200 | - */ | |
| 201 | -	public function getErrorCode() { | |
| 195 | + /** | |
| 196 | + * Return Error code | |
| 197 | + * @author Mehdi Hosseini <[email protected]> | |
| 198 | + * @since August 24, 2016 | |
| 199 | + * @return integer | |
| 200 | + */ | |
| 201 | + public function getErrorCode() { | |
| 202 | 202 | |
| 203 | - return $this->errorCode; | |
| 203 | + return $this->errorCode; | |
| 204 | 204 | |
| 205 | - } | |
| 205 | + } | |
| 206 | 206 | |
| 207 | - /** | |
| 208 | - * Get error message | |
| 209 | - * @author Mehdi Hosseini <[email protected]> | |
| 210 | - * @since August 24, 2016 | |
| 211 | - * @return string | |
| 212 | - */ | |
| 213 | -	public function getErrorMessage() { | |
| 207 | + /** | |
| 208 | + * Get error message | |
| 209 | + * @author Mehdi Hosseini <[email protected]> | |
| 210 | + * @since August 24, 2016 | |
| 211 | + * @return string | |
| 212 | + */ | |
| 213 | + public function getErrorMessage() { | |
| 214 | 214 | |
| 215 | - return $this->error['message']; | |
| 215 | + return $this->error['message']; | |
| 216 | 216 | |
| 217 | - } | |
| 217 | + } | |
| 218 | 218 | |
| 219 | - /** | |
| 220 | - * Get headers | |
| 221 | - * @author Shima Payro <[email protected]> | |
| 222 | - * @since Sep 13, 2016 | |
| 223 | - * @return array | |
| 224 | - */ | |
| 225 | -	public function getHeaders() { | |
| 219 | + /** | |
| 220 | + * Get headers | |
| 221 | + * @author Shima Payro <[email protected]> | |
| 222 | + * @since Sep 13, 2016 | |
| 223 | + * @return array | |
| 224 | + */ | |
| 225 | + public function getHeaders() { | |
| 226 | 226 | |
| 227 | - return $this->headers; | |
| 227 | + return $this->headers; | |
| 228 | 228 | |
| 229 | - } | |
| 229 | + } | |
| 230 | 230 | |
| 231 | - /** | |
| 232 | - * Set headers | |
| 233 | - * @author Shima Payro <[email protected]> | |
| 234 | - * @since Sep 13, 2016 | |
| 235 | - * @return array | |
| 236 | - */ | |
| 237 | -	public function setHeaders( $headers = [] ) { | |
| 231 | + /** | |
| 232 | + * Set headers | |
| 233 | + * @author Shima Payro <[email protected]> | |
| 234 | + * @since Sep 13, 2016 | |
| 235 | + * @return array | |
| 236 | + */ | |
| 237 | + public function setHeaders( $headers = [] ) { | |
| 238 | 238 | |
| 239 | - $this->headers = $headers; | |
| 239 | + $this->headers = $headers; | |
| 240 | 240 | |
| 241 | - return $this; | |
| 241 | + return $this; | |
| 242 | 242 | |
| 243 | - } | |
| 243 | + } | |
| 244 | 244 | |
| 245 | - /** | |
| 246 | - * Response which contains status and data | |
| 247 | - * @param null|array $data | |
| 248 | - * @author Shima Payro <[email protected]> | |
| 249 | - * @since May 2, 2016 9:50:19 AM | |
| 250 | - * @return Main|\Illuminate\Http\JsonResponse | |
| 251 | - * @uses | |
| 252 | - * @see | |
| 253 | - */ | |
| 254 | -	 public function respondWithResult( $data = NULL ) { | |
| 245 | + /** | |
| 246 | + * Response which contains status and data | |
| 247 | + * @param null|array $data | |
| 248 | + * @author Shima Payro <[email protected]> | |
| 249 | + * @since May 2, 2016 9:50:19 AM | |
| 250 | + * @return Main|\Illuminate\Http\JsonResponse | |
| 251 | + * @uses | |
| 252 | + * @see | |
| 253 | + */ | |
| 254 | +  public function respondWithResult( $data = NULL ) { | |
| 255 | 255 | |
| 256 | - $res[ 'status' ] = $this->getStatusText(); | |
| 256 | + $res[ 'status' ] = $this->getStatusText(); | |
| 257 | 257 | |
| 258 | - //if it's about laravel validation error | |
| 259 | -		if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) { | |
| 258 | + //if it's about laravel validation error | |
| 259 | +  if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) { | |
| 260 | 260 | |
| 261 | - $res[ 'error' ] = $this->getErrorCode(); | |
| 262 | - $res[ 'message' ] = $data; | |
| 261 | + $res[ 'error' ] = $this->getErrorCode(); | |
| 262 | + $res[ 'message' ] = $data; | |
| 263 | 263 | |
| 264 | -		} else { | |
| 264 | +  } else { | |
| 265 | 265 | |
| 266 | - $res[ 'result' ] = $data; | |
| 266 | + $res[ 'result' ] = $data; | |
| 267 | 267 | |
| 268 | - } | |
| 268 | + } | |
| 269 | 269 | |
| 270 | - return $this->respond( $res ); | |
| 270 | + return $this->respond( $res ); | |
| 271 | 271 | |
| 272 | - } | |
| 272 | + } | |
| 273 | 273 | |
| 274 | 274 | } | 
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | * Haeders | 
| 33 | 33 | * @var array | 
| 34 | 34 | */ | 
| 35 | - protected $headers = []; | |
| 35 | + protected $headers = [ ]; | |
| 36 | 36 | |
| 37 | 37 | /** | 
| 38 | 38 | * @var string | 
| @@ -53,10 +53,10 @@ discard block | ||
| 53 | 53 | |
| 54 | 54 | $this->lang = \App::getLocale(); | 
| 55 | 55 | |
| 56 | -		if(! file_exists(config_path($this->lang . '.php'))){ | |
| 57 | - $this->config = include __DIR__ . '/../errors/lang/' . $this->lang . '.php'; | |
| 56 | +		if (!file_exists(config_path($this->lang.'.php'))) { | |
| 57 | + $this->config = include __DIR__.'/../errors/lang/'.$this->lang.'.php'; | |
| 58 | 58 |          } else { | 
| 59 | - $this->config = include config_path($this->lang . '.php'); | |
| 59 | + $this->config = include config_path($this->lang.'.php'); | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | } | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | * @uses | 
| 84 | 84 | * @see | 
| 85 | 85 | */ | 
| 86 | -	public function setStatusCode( $statusCode ) { | |
| 86 | +	public function setStatusCode($statusCode) { | |
| 87 | 87 | |
| 88 | 88 | $this->statusCode = $statusCode; | 
| 89 | 89 | |
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | * @uses | 
| 114 | 114 | * @see | 
| 115 | 115 | */ | 
| 116 | -	public function setStatusText( $statusText ) { | |
| 116 | +	public function setStatusText($statusText) { | |
| 117 | 117 | |
| 118 | 118 | $this->statusText = $statusText; | 
| 119 | 119 | |
| @@ -130,15 +130,15 @@ discard block | ||
| 130 | 130 | * @uses | 
| 131 | 131 | * @see | 
| 132 | 132 | */ | 
| 133 | -	public function respond( $data ) { | |
| 133 | +	public function respond($data) { | |
| 134 | 134 | |
| 135 | - $result = array_filter( $this->getHeaders() ); | |
| 135 | + $result = array_filter($this->getHeaders()); | |
| 136 | 136 | |
| 137 | - if ( empty( $result ) ) | |
| 138 | - return response()->json( $data, $this->getStatusCode() ); | |
| 137 | + if (empty($result)) | |
| 138 | + return response()->json($data, $this->getStatusCode()); | |
| 139 | 139 | |
| 140 | - return response()->json( $data, $this->getStatusCode() ) | |
| 141 | - ->withHeaders( $this->getHeaders() ); | |
| 140 | + return response()->json($data, $this->getStatusCode()) | |
| 141 | + ->withHeaders($this->getHeaders()); | |
| 142 | 142 | |
| 143 | 143 | } | 
| 144 | 144 | |
| @@ -151,16 +151,16 @@ discard block | ||
| 151 | 151 | * @uses | 
| 152 | 152 | * @see | 
| 153 | 153 | */ | 
| 154 | -	public function respondWithMessage( $message = null ) { | |
| 154 | +	public function respondWithMessage($message = null) { | |
| 155 | 155 | |
| 156 | 156 | $res[ 'status' ] = $this->getStatusText(); | 
| 157 | 157 | |
| 158 | 158 | //if it's about failure | 
| 159 | -		if ( $this->getErrorCode() ) { | |
| 159 | +		if ($this->getErrorCode()) { | |
| 160 | 160 | |
| 161 | 161 | $res[ 'error' ] = $this->getErrorCode(); | 
| 162 | 162 | |
| 163 | - if ( is_null( $message ) ) | |
| 163 | + if (is_null($message)) | |
| 164 | 164 | $res[ 'message' ] = $this->getErrorMessage(); | 
| 165 | 165 | else | 
| 166 | 166 | $res[ 'message' ] = $message; | 
| @@ -171,7 +171,7 @@ discard block | ||
| 171 | 171 | |
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | - return $this->respond( $res ); | |
| 174 | + return $this->respond($res); | |
| 175 | 175 | |
| 176 | 176 | } | 
| 177 | 177 | |
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | * @param $errorCode integer | 
| 183 | 183 | * @return $this | 
| 184 | 184 | */ | 
| 185 | -	public function setErrorCode( $errorCode ) { | |
| 185 | +	public function setErrorCode($errorCode) { | |
| 186 | 186 | |
| 187 | 187 | $this->error = $this->config[ $errorCode ]; | 
| 188 | 188 | |
| @@ -212,7 +212,7 @@ discard block | ||
| 212 | 212 | */ | 
| 213 | 213 |  	public function getErrorMessage() { | 
| 214 | 214 | |
| 215 | - return $this->error['message']; | |
| 215 | + return $this->error[ 'message' ]; | |
| 216 | 216 | |
| 217 | 217 | } | 
| 218 | 218 | |
| @@ -234,7 +234,7 @@ discard block | ||
| 234 | 234 | * @since Sep 13, 2016 | 
| 235 | 235 | * @return array | 
| 236 | 236 | */ | 
| 237 | -	public function setHeaders( $headers = [] ) { | |
| 237 | +	public function setHeaders($headers = [ ]) { | |
| 238 | 238 | |
| 239 | 239 | $this->headers = $headers; | 
| 240 | 240 | |
| @@ -251,12 +251,12 @@ discard block | ||
| 251 | 251 | * @uses | 
| 252 | 252 | * @see | 
| 253 | 253 | */ | 
| 254 | -	 public function respondWithResult( $data = NULL ) { | |
| 254 | +	 public function respondWithResult($data = NULL) { | |
| 255 | 255 | |
| 256 | 256 | $res[ 'status' ] = $this->getStatusText(); | 
| 257 | 257 | |
| 258 | 258 | //if it's about laravel validation error | 
| 259 | -		if ( $this->getErrorCode() && $this->getStatusCode() == 420 ) { | |
| 259 | +		if ($this->getErrorCode() && $this->getStatusCode() == 420) { | |
| 260 | 260 | |
| 261 | 261 | $res[ 'error' ] = $this->getErrorCode(); | 
| 262 | 262 | $res[ 'message' ] = $data; | 
| @@ -267,7 +267,7 @@ discard block | ||
| 267 | 267 | |
| 268 | 268 | } | 
| 269 | 269 | |
| 270 | - return $this->respond( $res ); | |
| 270 | + return $this->respond($res); | |
| 271 | 271 | |
| 272 | 272 | } | 
| 273 | 273 | |
| @@ -2,196 +2,196 @@ | ||
| 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 | - 'fail' => [ | |
| 16 | - | |
| 17 | - 'insert' => 'The requested parameter is not Added!', | |
| 18 | - | |
| 19 | - 'delete' => 'The requested parameter is not deleted!', | |
| 20 | - | |
| 21 | - 'update' => 'The requested parameter is not updated!' | |
| 22 | - | |
| 23 | - ], | |
| 24 | - | |
| 25 | - 1001 => [ | |
| 26 | - 'message' => 'Oops... Requested field is not found!', | |
| 27 | - 'type' => 'error' | |
| 28 | - ], | |
| 29 | - | |
| 30 | - 1002 => [ | |
| 31 | - 'message' => 'Oops... Requested User does not exists!', | |
| 32 | - 'type' => 'error' | |
| 33 | - ], | |
| 34 | - | |
| 35 | - 1003 => [ | |
| 36 | - 'message' => 'Oops... Client type is not entered!', | |
| 37 | - 'type' => 'error' | |
| 38 | - ], | |
| 39 | - | |
| 40 | - 1004 => [ | |
| 41 | - 'message' => 'Failed because of duplicate', | |
| 42 | - 'type' => 'error' | |
| 43 | - ], | |
| 44 | - | |
| 45 | - 1005 => [ | |
| 46 | - 'message' => 'Failed because of dablicated user role', | |
| 47 | - 'type' => 'error' | |
| 48 | - ], | |
| 49 | - | |
| 50 | - 3001 => [ | |
| 51 | - 'message' => 'You are not logged on', | |
| 52 | - 'type' => 'error', | |
| 53 | - 'cat' => 'auth', | |
| 54 | - 'short' => 'not-logged-on' | |
| 55 | - ], | |
| 56 | - | |
| 57 | - 3002 => [ | |
| 58 | - 'message' => 'Application token did not generated successfully', | |
| 59 | - 'type' => 'error', | |
| 60 | - 'cat' => 'auth' | |
| 61 | - ], | |
| 62 | - | |
| 63 | - 3003 =>[ | |
| 64 | - 'message' => 'User token did not generated successfully', | |
| 65 | - 'type' => 'error', | |
| 66 | - 'cat' => 'auth' | |
| 67 | - ], | |
| 68 | - | |
| 69 | - 3004 => [ | |
| 70 | - 'message' => 'Request token have no agency access', | |
| 71 | - 'type' => 'error', | |
| 72 | - 'cat' => 'auth' | |
| 73 | - ], | |
| 74 | - | |
| 75 | - 3005 => [ | |
| 76 | - 'message' => 'Request token did not contains user information', | |
| 77 | - 'type' => 'error', | |
| 78 | - 'cat' => 'auth' | |
| 79 | - ], | |
| 80 | - | |
| 81 | - 3006 => [ | |
| 82 | - 'message' => 'Did not set request token', | |
| 83 | - 'type' => 'error', | |
| 84 | - 'cat' => 'auth' | |
| 85 | - ], | |
| 86 | - | |
| 87 | - 3007 => [ | |
| 88 | - 'message' => 'can not decode the token', | |
| 89 | - 'type' => 'error', | |
| 90 | - 'cat' => 'auth' | |
| 91 | - ], | |
| 92 | - | |
| 93 | - 3008 => [ | |
| 94 | - 'message' => 'can not generate token for authentication', | |
| 95 | - 'type' => 'error', | |
| 96 | - 'cat' => 'auth' | |
| 97 | - ], | |
| 98 | - | |
| 99 | - 3009 => [ | |
| 100 | - 'message' => 'can not create token', | |
| 101 | - 'type' => 'error', | |
| 102 | - 'cat' => 'auth' | |
| 103 | - ], | |
| 104 | - | |
| 105 | - 3010 => [ | |
| 106 | - 'message' => 'Token expired!', | |
| 107 | - 'type' => 'error', | |
| 108 | - 'cat' => 'auth' | |
| 109 | - ], | |
| 110 | - | |
| 111 | - 3011 => [ | |
| 112 | - 'message' => 'Token is invalid!', | |
| 113 | - 'type' => 'error', | |
| 114 | - 'cat' => 'auth' | |
| 115 | - ], | |
| 116 | - | |
| 117 | - 3012 => [ | |
| 118 | - 'message' => 'Token Blacklisted', | |
| 119 | - 'type' => 'error', | |
| 120 | - 'cat' => 'auth' | |
| 121 | - ], | |
| 122 | - | |
| 123 | - 3013 => [ | |
| 124 | - 'message' => 'Payload invalid!', | |
| 125 | - 'type' => 'error', | |
| 126 | - 'cat' => 'auth' | |
| 127 | - ], | |
| 128 | - | |
| 129 | - 3014 => [ | |
| 130 | - 'message' => 'Claim Invalid', | |
| 131 | - 'type' => 'error', | |
| 132 | - 'cat' => 'auth' | |
| 133 | - ], | |
| 134 | - | |
| 135 | - 3015 => [ | |
| 136 | - 'message' => 'An error occurred on token validation', | |
| 137 | - 'type' => 'error', | |
| 138 | - 'cat' => 'auth' | |
| 139 | - ], | |
| 140 | - | |
| 141 | - 3016 => [ | |
| 142 | - | |
| 143 | - 'message' => 'This domain has been blocked', | |
| 144 | - 'type' => 'error' | |
| 145 | - ], | |
| 146 | - | |
| 147 | - 5401 => [ | |
| 148 | - 'message' => 'Authentication unauthorized...', | |
| 149 | - 'type' => 'error' | |
| 150 | - ], | |
| 151 | - | |
| 152 | - 5404 => [ | |
| 153 | - 'message' => 'Oops... The requested page not found!', | |
| 154 | - 'type' => 'error' | |
| 155 | - ], | |
| 156 | - | |
| 157 | - 5405 => [ | |
| 158 | - 'message' => 'Oops... The method you requested is not allowed!', | |
| 159 | - 'type' => 'error' | |
| 160 | - ], | |
| 161 | - | |
| 162 | - 5406 => [ | |
| 163 | - 'message' => 'Oops... The parameters you entered are wrong!', | |
| 164 | - 'type' => 'error' | |
| 165 | - ], | |
| 166 | - | |
| 167 | - 5420 => [ | |
| 168 | - 'message' => 'Validation Error', | |
| 169 | - 'type' => 'error' | |
| 170 | - ], | |
| 171 | - | |
| 172 | - 5422 => [ | |
| 173 | - 'message' => 'Token is not valid', | |
| 174 | - 'type' => 'error' | |
| 175 | - ], | |
| 176 | - | |
| 177 | - 5445 => [ | |
| 178 | - 'message' => 'Oops... Database connection refused', | |
| 179 | - 'type' => 'error' | |
| 180 | - ], | |
| 181 | - | |
| 182 | - 5448 => [ | |
| 183 | - 'message' => 'Oops... Insert action was not successfully executed', | |
| 184 | - 'type' => 'error' | |
| 185 | - ], | |
| 186 | - | |
| 187 | - 5447 => [ | |
| 188 | - 'message' => 'Oops... Delete action was not successfully executed', | |
| 189 | - 'type' => 'error' | |
| 190 | - ], | |
| 191 | - | |
| 192 | - 5449 => [ | |
| 193 | - 'message' => 'Oops... Update action was not successfully executed', | |
| 194 | - 'type' => 'error' | |
| 195 | - ] | |
| 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 | + 'fail' => [ | |
| 16 | + | |
| 17 | + 'insert' => 'The requested parameter is not Added!', | |
| 18 | + | |
| 19 | + 'delete' => 'The requested parameter is not deleted!', | |
| 20 | + | |
| 21 | + 'update' => 'The requested parameter is not updated!' | |
| 22 | + | |
| 23 | + ], | |
| 24 | + | |
| 25 | + 1001 => [ | |
| 26 | + 'message' => 'Oops... Requested field is not found!', | |
| 27 | + 'type' => 'error' | |
| 28 | + ], | |
| 29 | + | |
| 30 | + 1002 => [ | |
| 31 | + 'message' => 'Oops... Requested User does not exists!', | |
| 32 | + 'type' => 'error' | |
| 33 | + ], | |
| 34 | + | |
| 35 | + 1003 => [ | |
| 36 | + 'message' => 'Oops... Client type is not entered!', | |
| 37 | + 'type' => 'error' | |
| 38 | + ], | |
| 39 | + | |
| 40 | + 1004 => [ | |
| 41 | + 'message' => 'Failed because of duplicate', | |
| 42 | + 'type' => 'error' | |
| 43 | + ], | |
| 44 | + | |
| 45 | + 1005 => [ | |
| 46 | + 'message' => 'Failed because of dablicated user role', | |
| 47 | + 'type' => 'error' | |
| 48 | + ], | |
| 49 | + | |
| 50 | + 3001 => [ | |
| 51 | + 'message' => 'You are not logged on', | |
| 52 | + 'type' => 'error', | |
| 53 | + 'cat' => 'auth', | |
| 54 | + 'short' => 'not-logged-on' | |
| 55 | + ], | |
| 56 | + | |
| 57 | + 3002 => [ | |
| 58 | + 'message' => 'Application token did not generated successfully', | |
| 59 | + 'type' => 'error', | |
| 60 | + 'cat' => 'auth' | |
| 61 | + ], | |
| 62 | + | |
| 63 | + 3003 =>[ | |
| 64 | + 'message' => 'User token did not generated successfully', | |
| 65 | + 'type' => 'error', | |
| 66 | + 'cat' => 'auth' | |
| 67 | + ], | |
| 68 | + | |
| 69 | + 3004 => [ | |
| 70 | + 'message' => 'Request token have no agency access', | |
| 71 | + 'type' => 'error', | |
| 72 | + 'cat' => 'auth' | |
| 73 | + ], | |
| 74 | + | |
| 75 | + 3005 => [ | |
| 76 | + 'message' => 'Request token did not contains user information', | |
| 77 | + 'type' => 'error', | |
| 78 | + 'cat' => 'auth' | |
| 79 | + ], | |
| 80 | + | |
| 81 | + 3006 => [ | |
| 82 | + 'message' => 'Did not set request token', | |
| 83 | + 'type' => 'error', | |
| 84 | + 'cat' => 'auth' | |
| 85 | + ], | |
| 86 | + | |
| 87 | + 3007 => [ | |
| 88 | + 'message' => 'can not decode the token', | |
| 89 | + 'type' => 'error', | |
| 90 | + 'cat' => 'auth' | |
| 91 | + ], | |
| 92 | + | |
| 93 | + 3008 => [ | |
| 94 | + 'message' => 'can not generate token for authentication', | |
| 95 | + 'type' => 'error', | |
| 96 | + 'cat' => 'auth' | |
| 97 | + ], | |
| 98 | + | |
| 99 | + 3009 => [ | |
| 100 | + 'message' => 'can not create token', | |
| 101 | + 'type' => 'error', | |
| 102 | + 'cat' => 'auth' | |
| 103 | + ], | |
| 104 | + | |
| 105 | + 3010 => [ | |
| 106 | + 'message' => 'Token expired!', | |
| 107 | + 'type' => 'error', | |
| 108 | + 'cat' => 'auth' | |
| 109 | + ], | |
| 110 | + | |
| 111 | + 3011 => [ | |
| 112 | + 'message' => 'Token is invalid!', | |
| 113 | + 'type' => 'error', | |
| 114 | + 'cat' => 'auth' | |
| 115 | + ], | |
| 116 | + | |
| 117 | + 3012 => [ | |
| 118 | + 'message' => 'Token Blacklisted', | |
| 119 | + 'type' => 'error', | |
| 120 | + 'cat' => 'auth' | |
| 121 | + ], | |
| 122 | + | |
| 123 | + 3013 => [ | |
| 124 | + 'message' => 'Payload invalid!', | |
| 125 | + 'type' => 'error', | |
| 126 | + 'cat' => 'auth' | |
| 127 | + ], | |
| 128 | + | |
| 129 | + 3014 => [ | |
| 130 | + 'message' => 'Claim Invalid', | |
| 131 | + 'type' => 'error', | |
| 132 | + 'cat' => 'auth' | |
| 133 | + ], | |
| 134 | + | |
| 135 | + 3015 => [ | |
| 136 | + 'message' => 'An error occurred on token validation', | |
| 137 | + 'type' => 'error', | |
| 138 | + 'cat' => 'auth' | |
| 139 | + ], | |
| 140 | + | |
| 141 | + 3016 => [ | |
| 142 | + | |
| 143 | + 'message' => 'This domain has been blocked', | |
| 144 | + 'type' => 'error' | |
| 145 | + ], | |
| 146 | + | |
| 147 | + 5401 => [ | |
| 148 | + 'message' => 'Authentication unauthorized...', | |
| 149 | + 'type' => 'error' | |
| 150 | + ], | |
| 151 | + | |
| 152 | + 5404 => [ | |
| 153 | + 'message' => 'Oops... The requested page not found!', | |
| 154 | + 'type' => 'error' | |
| 155 | + ], | |
| 156 | + | |
| 157 | + 5405 => [ | |
| 158 | + 'message' => 'Oops... The method you requested is not allowed!', | |
| 159 | + 'type' => 'error' | |
| 160 | + ], | |
| 161 | + | |
| 162 | + 5406 => [ | |
| 163 | + 'message' => 'Oops... The parameters you entered are wrong!', | |
| 164 | + 'type' => 'error' | |
| 165 | + ], | |
| 166 | + | |
| 167 | + 5420 => [ | |
| 168 | + 'message' => 'Validation Error', | |
| 169 | + 'type' => 'error' | |
| 170 | + ], | |
| 171 | + | |
| 172 | + 5422 => [ | |
| 173 | + 'message' => 'Token is not valid', | |
| 174 | + 'type' => 'error' | |
| 175 | + ], | |
| 176 | + | |
| 177 | + 5445 => [ | |
| 178 | + 'message' => 'Oops... Database connection refused', | |
| 179 | + 'type' => 'error' | |
| 180 | + ], | |
| 181 | + | |
| 182 | + 5448 => [ | |
| 183 | + 'message' => 'Oops... Insert action was not successfully executed', | |
| 184 | + 'type' => 'error' | |
| 185 | + ], | |
| 186 | + | |
| 187 | + 5447 => [ | |
| 188 | + 'message' => 'Oops... Delete action was not successfully executed', | |
| 189 | + 'type' => 'error' | |
| 190 | + ], | |
| 191 | + | |
| 192 | + 5449 => [ | |
| 193 | + 'message' => 'Oops... Update action was not successfully executed', | |
| 194 | + 'type' => 'error' | |
| 195 | + ] | |
| 196 | 196 | |
| 197 | 197 | ]; |