Completed
Push — dev ( 0ee1b7...c0bb06 )
by Marcin
18s queued 13s
created
src/ApiCodesHelpers.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -21,125 +21,125 @@
 block discarded – undo
21 21
  */
22 22
 trait ApiCodesHelpers
23 23
 {
24
-    /**
25
-     * Returns lowest allowed error code for this module
26
-     *
27
-     * @return integer
28
-     *
29
-     * @throws \RuntimeException Throws exception if no min_code set up
30
-     */
31
-    public static function getMinCode(): int
32
-    {
33
-        $key = ResponseBuilder::CONF_KEY_MIN_CODE;
34
-        $min_code = Config::get($key, null);
35
-
36
-        if ($min_code === null) {
37
-            throw new \RuntimeException(sprintf('CONFIG: Missing "%s" key', $key));
38
-        }
39
-
40
-        return $min_code;
41
-    }
42
-
43
-    /**
44
-     * Returns highest allowed error code for this module
45
-     *
46
-     * @return integer
47
-     *
48
-     * @throws \RuntimeException Throws exception if no max_code set up
49
-     */
50
-    public static function getMaxCode(): int
51
-    {
52
-        $key = ResponseBuilder::CONF_KEY_MAX_CODE;
53
-        $max_code = Config::get($key, null);
54
-
55
-        if ($max_code === null) {
56
-            throw new \RuntimeException(sprintf('CONFIG: Missing "%s" key', $key));
57
-        }
58
-
59
-        return $max_code;
60
-    }
61
-
62
-    /**
63
-     * Returns array of error code constants defined in this class. Used mainly for debugging/tests
64
-     *
65
-     * @return array
66
-     * @throws \ReflectionException
67
-     */
68
-    public static function getApiCodeConstants(): array
69
-    {
70
-        /** @noinspection PhpUnhandledExceptionInspection */
71
-        return (new \ReflectionClass(static::class))->getConstants();
72
-    }
73
-
74
-    /**
75
-     * Returns complete error code to locale string mapping array
76
-     *
77
-     * @return array
78
-     *
79
-     * @throws \RuntimeException Thrown when builder map is not configured.
80
-     */
81
-    public static function getMap(): array
82
-    {
83
-        $user_map = Config::get(ResponseBuilder::CONF_KEY_MAP, null);
84
-        if ($user_map === null) {
85
-            throw new \RuntimeException(sprintf('CONFIG: Missing "%s" key', ResponseBuilder::CONF_KEY_MAP));
86
-        }
87
-        if (!\is_array($user_map)) {
88
-            throw new \RuntimeException(sprintf('CONFIG: "%s" must be an array', ResponseBuilder::CONF_KEY_MAP));
89
-        }
90
-        return Util::mergeConfig(BaseApiCodes::getBaseMap(), $user_map);
91
-    }
92
-
93
-    /**
94
-     * Returns locale mappings key for given api code or @null if there's no mapping
95
-     *
96
-     * @param integer $api_code Api code to look for mapped message for.
97
-     *
98
-     * @return string|null
99
-     *
100
-     * @throws \InvalidArgumentException If $code is not in allowed range.
101
-     */
102
-    public static function getCodeMessageKey(int $api_code): ?string
103
-    {
104
-        if (!static::isCodeValid($api_code)) {
105
-            $min = static::getMinCode();
106
-            $max = static::getMaxCode();
107
-            throw new \InvalidArgumentException("API code value ({$api_code}) is out of allowed range {$min}-{$max}");
108
-        }
109
-
110
-        $map = static::getMap();
111
-
112
-        return $map[ $api_code ] ?? null;
113
-    }
114
-
115
-    /**
116
-     * Checks if given API $code can be used in current configuration.
117
-     *
118
-     * @param int $code API code to validate
119
-     *
120
-     * @return bool
121
-     */
122
-    public static function isCodeValid(int $code): bool
123
-    {
124
-        return ($code === 0) || (($code >= static::getMinCode()) && ($code <= static::getMaxCode()));
125
-    }
126
-
127
-    /**
128
-     * Returns final API code for internal code, remapped to configured code range
129
-     *
130
-     * @param int $internal_code
131
-     *
132
-     * @return int
133
-     *
134
-     * @throws \InvalidArgumentException
135
-     */
136
-    public static function getCodeForInternalOffset(int $internal_code): int
137
-    {
138
-        $min = static::RESERVED_MIN_API_CODE_OFFSET;
139
-        $max = static::RESERVED_MAX_API_CODE_OFFSET;
140
-        Validator::assertIsIntRange('internal_code', $internal_code, $min, $max);
141
-
142
-        return ($internal_code === 0) ? 0 : $internal_code + static::getMinCode();
143
-    }
24
+	/**
25
+	 * Returns lowest allowed error code for this module
26
+	 *
27
+	 * @return integer
28
+	 *
29
+	 * @throws \RuntimeException Throws exception if no min_code set up
30
+	 */
31
+	public static function getMinCode(): int
32
+	{
33
+		$key = ResponseBuilder::CONF_KEY_MIN_CODE;
34
+		$min_code = Config::get($key, null);
35
+
36
+		if ($min_code === null) {
37
+			throw new \RuntimeException(sprintf('CONFIG: Missing "%s" key', $key));
38
+		}
39
+
40
+		return $min_code;
41
+	}
42
+
43
+	/**
44
+	 * Returns highest allowed error code for this module
45
+	 *
46
+	 * @return integer
47
+	 *
48
+	 * @throws \RuntimeException Throws exception if no max_code set up
49
+	 */
50
+	public static function getMaxCode(): int
51
+	{
52
+		$key = ResponseBuilder::CONF_KEY_MAX_CODE;
53
+		$max_code = Config::get($key, null);
54
+
55
+		if ($max_code === null) {
56
+			throw new \RuntimeException(sprintf('CONFIG: Missing "%s" key', $key));
57
+		}
58
+
59
+		return $max_code;
60
+	}
61
+
62
+	/**
63
+	 * Returns array of error code constants defined in this class. Used mainly for debugging/tests
64
+	 *
65
+	 * @return array
66
+	 * @throws \ReflectionException
67
+	 */
68
+	public static function getApiCodeConstants(): array
69
+	{
70
+		/** @noinspection PhpUnhandledExceptionInspection */
71
+		return (new \ReflectionClass(static::class))->getConstants();
72
+	}
73
+
74
+	/**
75
+	 * Returns complete error code to locale string mapping array
76
+	 *
77
+	 * @return array
78
+	 *
79
+	 * @throws \RuntimeException Thrown when builder map is not configured.
80
+	 */
81
+	public static function getMap(): array
82
+	{
83
+		$user_map = Config::get(ResponseBuilder::CONF_KEY_MAP, null);
84
+		if ($user_map === null) {
85
+			throw new \RuntimeException(sprintf('CONFIG: Missing "%s" key', ResponseBuilder::CONF_KEY_MAP));
86
+		}
87
+		if (!\is_array($user_map)) {
88
+			throw new \RuntimeException(sprintf('CONFIG: "%s" must be an array', ResponseBuilder::CONF_KEY_MAP));
89
+		}
90
+		return Util::mergeConfig(BaseApiCodes::getBaseMap(), $user_map);
91
+	}
92
+
93
+	/**
94
+	 * Returns locale mappings key for given api code or @null if there's no mapping
95
+	 *
96
+	 * @param integer $api_code Api code to look for mapped message for.
97
+	 *
98
+	 * @return string|null
99
+	 *
100
+	 * @throws \InvalidArgumentException If $code is not in allowed range.
101
+	 */
102
+	public static function getCodeMessageKey(int $api_code): ?string
103
+	{
104
+		if (!static::isCodeValid($api_code)) {
105
+			$min = static::getMinCode();
106
+			$max = static::getMaxCode();
107
+			throw new \InvalidArgumentException("API code value ({$api_code}) is out of allowed range {$min}-{$max}");
108
+		}
109
+
110
+		$map = static::getMap();
111
+
112
+		return $map[ $api_code ] ?? null;
113
+	}
114
+
115
+	/**
116
+	 * Checks if given API $code can be used in current configuration.
117
+	 *
118
+	 * @param int $code API code to validate
119
+	 *
120
+	 * @return bool
121
+	 */
122
+	public static function isCodeValid(int $code): bool
123
+	{
124
+		return ($code === 0) || (($code >= static::getMinCode()) && ($code <= static::getMaxCode()));
125
+	}
126
+
127
+	/**
128
+	 * Returns final API code for internal code, remapped to configured code range
129
+	 *
130
+	 * @param int $internal_code
131
+	 *
132
+	 * @return int
133
+	 *
134
+	 * @throws \InvalidArgumentException
135
+	 */
136
+	public static function getCodeForInternalOffset(int $internal_code): int
137
+	{
138
+		$min = static::RESERVED_MIN_API_CODE_OFFSET;
139
+		$max = static::RESERVED_MAX_API_CODE_OFFSET;
140
+		Validator::assertIsIntRange('internal_code', $internal_code, $min, $max);
141
+
142
+		return ($internal_code === 0) ? 0 : $internal_code + static::getMinCode();
143
+	}
144 144
 
145 145
 }
Please login to merge, or discard this patch.
src/Converters/ToArrayConverter.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@
 block discarded – undo
19 19
 
20 20
 final class ToArrayConverter implements ConverterContract
21 21
 {
22
-    /**
23
-     * Returns array representation of the object.
24
-     *
25
-     * @param object $obj    Object to be converted
26
-     * @param array  $config Converter config array to be used for this object (based on exact class
27
-     *                       name match or inheritance).
28
-     *
29
-     * @return array
30
-     */
31
-    public function convert($obj, /** @scrutinizer ignore-unused */ array $config): array
32
-    {
33
-        Validator::assertIsObject('obj', $obj);
22
+	/**
23
+	 * Returns array representation of the object.
24
+	 *
25
+	 * @param object $obj    Object to be converted
26
+	 * @param array  $config Converter config array to be used for this object (based on exact class
27
+	 *                       name match or inheritance).
28
+	 *
29
+	 * @return array
30
+	 */
31
+	public function convert($obj, /** @scrutinizer ignore-unused */ array $config): array
32
+	{
33
+		Validator::assertIsObject('obj', $obj);
34 34
 
35
-        return $obj->toArray();
36
-    }
35
+		return $obj->toArray();
36
+	}
37 37
 }
Please login to merge, or discard this patch.
src/Converters/ArrayableConverter.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@
 block discarded – undo
19 19
 
20 20
 final class ArrayableConverter implements ConverterContract
21 21
 {
22
-    /**
23
-     * Returns array representation of the object implementing Arrayable interface
24
-     *
25
-     * @param Arrayable $obj    Object to be converted
26
-     * @param array     $config Converter config array to be used for this object (based on exact class
27
-     *                          name match or inheritance).
28
-     *
29
-     * @return array
30
-     */
31
-    public function convert($obj, /** @scrutinizer ignore-unused */ array $config): array
32
-    {
33
-        Validator::assertInstanceOf('obj', $obj, Arrayable::class);
22
+	/**
23
+	 * Returns array representation of the object implementing Arrayable interface
24
+	 *
25
+	 * @param Arrayable $obj    Object to be converted
26
+	 * @param array     $config Converter config array to be used for this object (based on exact class
27
+	 *                          name match or inheritance).
28
+	 *
29
+	 * @return array
30
+	 */
31
+	public function convert($obj, /** @scrutinizer ignore-unused */ array $config): array
32
+	{
33
+		Validator::assertInstanceOf('obj', $obj, Arrayable::class);
34 34
 
35
-        return $obj->toArray();
36
-    }
35
+		return $obj->toArray();
36
+	}
37 37
 }
Please login to merge, or discard this patch.
src/ExceptionHandlerHelper.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return \Symfony\Component\HttpFoundation\Response
73 73
 	 */
74 74
 	protected static function processException(\Exception $ex, array $ex_cfg,
75
-	                                           int $fallback_http_code = HttpResponse::HTTP_INTERNAL_SERVER_ERROR)
75
+											   int $fallback_http_code = HttpResponse::HTTP_INTERNAL_SERVER_ERROR)
76 76
 	{
77 77
 		$api_code = $ex_cfg['api_code'];
78 78
 		$http_code = $ex_cfg['http_code'] ?? $fallback_http_code;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return HttpResponse
143 143
 	 */
144 144
 	protected function unauthenticated(/** @scrutinizer ignore-unused */ $request,
145
-	                                                                     AuthException $exception): HttpResponse
145
+																		 AuthException $exception): HttpResponse
146 146
 	{
147 147
 		$cfg = self::getExceptionHandlerConfig();
148 148
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @return HttpResponse
164 164
 	 */
165 165
 	protected static function error(Exception $ex,
166
-	                                int $api_code, int $http_code = null, string $error_message): HttpResponse
166
+									int $api_code, int $http_code = null, string $error_message): HttpResponse
167 167
 	{
168 168
 		$ex_http_code = ($ex instanceof HttpException) ? $ex->getStatusCode() : $ex->getCode();
169 169
 		$http_code = $http_code ?? $ex_http_code;
Please login to merge, or discard this patch.
src/Util.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,60 +15,60 @@
 block discarded – undo
15 15
  */
16 16
 final class Util
17 17
 {
18
-    /**
19
-     * Merges the configs together and takes multi-dimensional arrays into account.
20
-     * Support for multi-dimensional config array. Built-in config merge only supports flat arrays.
21
-     * Throws \RuntimeException if arrays stucture causes type conflics (i.e. you want to merge
22
-     * array with int).
23
-     *
24
-     * @param array $original Array to merge other array into. Usually default values to overwrite.
25
-     * @param array $merging  Array with items to be merged into $original, overriding (primitives) or merging
26
-     *                        (arrays) entries in destination array.
27
-     *
28
-     * @return array
29
-     *
30
-     * @throws \RuntimeException
31
-     */
32
-    public static function mergeConfig(array $original, array $merging): array
33
-    {
34
-        $array = $original;
35
-        foreach ($merging as $m_key => $m_val) {
36
-            if (\array_key_exists($m_key, $original)) {
37
-                $orig_type = \gettype($original[ $m_key ]);
38
-                $m_type = \gettype($m_val);
39
-                if ($orig_type !== $m_type) {
40
-                    throw new \RuntimeException(
41
-                        "Incompatible types. Cannot merge {$m_type} into {$orig_type} (key '{$m_key}').");
42
-                }
18
+	/**
19
+	 * Merges the configs together and takes multi-dimensional arrays into account.
20
+	 * Support for multi-dimensional config array. Built-in config merge only supports flat arrays.
21
+	 * Throws \RuntimeException if arrays stucture causes type conflics (i.e. you want to merge
22
+	 * array with int).
23
+	 *
24
+	 * @param array $original Array to merge other array into. Usually default values to overwrite.
25
+	 * @param array $merging  Array with items to be merged into $original, overriding (primitives) or merging
26
+	 *                        (arrays) entries in destination array.
27
+	 *
28
+	 * @return array
29
+	 *
30
+	 * @throws \RuntimeException
31
+	 */
32
+	public static function mergeConfig(array $original, array $merging): array
33
+	{
34
+		$array = $original;
35
+		foreach ($merging as $m_key => $m_val) {
36
+			if (\array_key_exists($m_key, $original)) {
37
+				$orig_type = \gettype($original[ $m_key ]);
38
+				$m_type = \gettype($m_val);
39
+				if ($orig_type !== $m_type) {
40
+					throw new \RuntimeException(
41
+						"Incompatible types. Cannot merge {$m_type} into {$orig_type} (key '{$m_key}').");
42
+				}
43 43
 
44
-                if (\is_array($merging[ $m_key ])) {
45
-                    $array[ $m_key ] = static::mergeConfig($original[ $m_key ], $m_val);
46
-                } else {
47
-                    $array[ $m_key ] = $m_val;
48
-                }
49
-            } else {
50
-                $array[ $m_key ] = $m_val;
51
-            }
52
-        }
44
+				if (\is_array($merging[ $m_key ])) {
45
+					$array[ $m_key ] = static::mergeConfig($original[ $m_key ], $m_val);
46
+				} else {
47
+					$array[ $m_key ] = $m_val;
48
+				}
49
+			} else {
50
+				$array[ $m_key ] = $m_val;
51
+			}
52
+		}
53 53
 
54
-        return $array;
55
-    }
54
+		return $array;
55
+	}
56 56
 
57
-    /**
58
-     * Sorts array (in place) by value, assuming value is an array and contains `pri` key with integer
59
-     * (positive/negative) value which is used for sorting higher -> lower priority.
60
-     *
61
-     * @param array &$array
62
-     */
63
-    public static function sortArrayByPri(array &$array): void
64
-    {
65
-        uasort($array, static function(array $array_a, array $array_b) {
66
-            $pri_a = $array_a['pri'] ?? 0;
67
-            $pri_b = $array_b['pri'] ?? 0;
57
+	/**
58
+	 * Sorts array (in place) by value, assuming value is an array and contains `pri` key with integer
59
+	 * (positive/negative) value which is used for sorting higher -> lower priority.
60
+	 *
61
+	 * @param array &$array
62
+	 */
63
+	public static function sortArrayByPri(array &$array): void
64
+	{
65
+		uasort($array, static function(array $array_a, array $array_b) {
66
+			$pri_a = $array_a['pri'] ?? 0;
67
+			$pri_b = $array_b['pri'] ?? 0;
68 68
 
69
-            return $pri_b <=> $pri_a;
70
-        });
71
-    }
69
+			return $pri_b <=> $pri_a;
70
+		});
71
+	}
72 72
 
73 73
 	/**
74 74
 	 * Prints content of given array in compacted form.
Please login to merge, or discard this patch.
config/response_builder.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -12,78 +12,78 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 return [
15
-    /*
15
+	/*
16 16
     |-----------------------------------------------------------------------------------------------------------
17 17
     | Code range settings
18 18
     |-----------------------------------------------------------------------------------------------------------
19 19
     */
20
-    'min_code'          => 100,
21
-    'max_code'          => 1024,
20
+	'min_code'          => 100,
21
+	'max_code'          => 1024,
22 22
 
23
-    /*
23
+	/*
24 24
     |-----------------------------------------------------------------------------------------------------------
25 25
     | Error code to message mapping
26 26
     |-----------------------------------------------------------------------------------------------------------
27 27
     |
28 28
     */
29
-    'map'               => [
30
-        // YOUR_API_CODE => '<MESSAGE_KEY>',
31
-    ],
29
+	'map'               => [
30
+		// YOUR_API_CODE => '<MESSAGE_KEY>',
31
+	],
32 32
 
33
-    /*
33
+	/*
34 34
     |-----------------------------------------------------------------------------------------------------------
35 35
     | Response Builder data converter
36 36
     |-----------------------------------------------------------------------------------------------------------
37 37
     |
38 38
     */
39
-    'converter'         => [
40
-        \Illuminate\Database\Eloquent\Model::class          => [
41
-            'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
42
-            // 'key'     => 'item',
43
-            'pri'     => 0,
44
-        ],
45
-        \Illuminate\Support\Collection::class               => [
46
-            'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
47
-            // 'key'     => 'item',
48
-            'pri'     => 0,
49
-        ],
50
-        \Illuminate\Database\Eloquent\Collection::class     => [
51
-            'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
52
-            // 'key'     => 'item',
53
-            'pri'     => 0,
54
-        ],
55
-        \Illuminate\Http\Resources\Json\JsonResource::class => [
56
-            'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
57
-            // 'key'     => 'item',
58
-            'pri'     => 0,
59
-        ],
39
+	'converter'         => [
40
+		\Illuminate\Database\Eloquent\Model::class          => [
41
+			'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
42
+			// 'key'     => 'item',
43
+			'pri'     => 0,
44
+		],
45
+		\Illuminate\Support\Collection::class               => [
46
+			'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
47
+			// 'key'     => 'item',
48
+			'pri'     => 0,
49
+		],
50
+		\Illuminate\Database\Eloquent\Collection::class     => [
51
+			'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
52
+			// 'key'     => 'item',
53
+			'pri'     => 0,
54
+		],
55
+		\Illuminate\Http\Resources\Json\JsonResource::class => [
56
+			'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ToArrayConverter::class,
57
+			// 'key'     => 'item',
58
+			'pri'     => 0,
59
+		],
60 60
 
61
-        /*
61
+		/*
62 62
         |-----------------------------------------------------------------------------------------------------------
63 63
         | Generic converters should have lower pri to allow dedicated ones to kick in first when class matches
64 64
         |-----------------------------------------------------------------------------------------------------------
65 65
         */
66
-        \JsonSerializable::class                            => [
67
-            'handler' => \MarcinOrlowski\ResponseBuilder\Converters\JsonSerializableConverter::class,
68
-            // 'key'     => 'item',
69
-            'pri'     => -10,
70
-        ],
71
-        \Illuminate\Contracts\Support\Arrayable::class      => [
72
-            'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ArrayableConverter::class,
73
-            // 'key'     => 'item',
74
-            'pri'     => -10,
75
-        ],
66
+		\JsonSerializable::class                            => [
67
+			'handler' => \MarcinOrlowski\ResponseBuilder\Converters\JsonSerializableConverter::class,
68
+			// 'key'     => 'item',
69
+			'pri'     => -10,
70
+		],
71
+		\Illuminate\Contracts\Support\Arrayable::class      => [
72
+			'handler' => \MarcinOrlowski\ResponseBuilder\Converters\ArrayableConverter::class,
73
+			// 'key'     => 'item',
74
+			'pri'     => -10,
75
+		],
76 76
 
77
-    ],
77
+	],
78 78
 
79
-    /*
79
+	/*
80 80
     |-----------------------------------------------------------------------------------------------------------
81 81
     | Exception handler error codes
82 82
     |-----------------------------------------------------------------------------------------------------------
83 83
     |
84 84
     */
85
-    'exception_handler' => [
86
-	    /*
85
+	'exception_handler' => [
86
+		/*
87 87
 	     * The following keys are supported for each handler specified.
88 88
 	     *   `handler`
89 89
 	     *   `pri`
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
 		 *                  message ($ex->getMessage()).
104 104
 		 */
105 105
 
106
-    	Illuminate\Validation\ValidationException::class => [
107
-		    'handler' => \MarcinOrlowski\ResponseBuilder\ExceptionHandlers\ValidationExceptionHandler::class,
108
-		    'pri'     => -100,
109
-		    'config' => [
110
-		    	],
111
-	    ],
106
+		Illuminate\Validation\ValidationException::class => [
107
+			'handler' => \MarcinOrlowski\ResponseBuilder\ExceptionHandlers\ValidationExceptionHandler::class,
108
+			'pri'     => -100,
109
+			'config' => [
110
+				],
111
+		],
112 112
 
113 113
 		\Symfony\Component\HttpKernel\Exception\HttpException::class => [
114
-	        'handler' => \MarcinOrlowski\ResponseBuilder\ExceptionHandlers\HttpExceptionHandler::class,
115
-	        'pri'     => -100,
116
-	        'config'  => [
114
+			'handler' => \MarcinOrlowski\ResponseBuilder\ExceptionHandlers\HttpExceptionHandler::class,
115
+			'pri'     => -100,
116
+			'config'  => [
117 117
 //		        HttpException::class => [
118 118
 //			        // used by unauthenticated() to obtain api and http code for the exception
119 119
 //			        HttpResponse::HTTP_UNAUTHORIZED         => [
@@ -129,41 +129,41 @@  discard block
 block discarded – undo
129 129
 //				        'http_code' => HttpResponse::HTTP_BAD_REQUEST,
130 130
 //			        ],
131 131
 //		        ],
132
-	        ],
132
+			],
133 133
 //	        // This is final exception handler. If ex is not dealt with yet this is its last stop.
134
-	        // default handler is mandatory and MUST have both `api_code` and `http_code` set.
134
+			// default handler is mandatory and MUST have both `api_code` and `http_code` set.
135 135
 
136
-	        'default' => [
137
-		        'handler' => \MarcinOrlowski\ResponseBuilder\ExceptionHandlers\HttpExceptionHandler::class,
138
-		        'pri'     => -127,
139
-		        'config'  => [
136
+			'default' => [
137
+				'handler' => \MarcinOrlowski\ResponseBuilder\ExceptionHandlers\HttpExceptionHandler::class,
138
+				'pri'     => -127,
139
+				'config'  => [
140 140
 //			        'api_code'  => ApiCodes::YOUR_API_CODE_FOR_UNHANDLED_EXCEPTION,
141 141
 //			        'http_code' => HttpResponse::HTTP_INTERNAL_SERVER_ERROR,
142
-		        ],
143
-	        ],
144
-	    ],
145
-    ],
142
+				],
143
+			],
144
+		],
145
+	],
146 146
 
147
-    /*
147
+	/*
148 148
     |-----------------------------------------------------------------------------------------------------------
149 149
     | data-to-json encoding options
150 150
     |-----------------------------------------------------------------------------------------------------------
151 151
     |
152 152
     */
153
-    'encoding_options'  => JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE,
153
+	'encoding_options'  => JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE,
154 154
 
155
-    /*
155
+	/*
156 156
     |-----------------------------------------------------------------------------------------------------------
157 157
     | Debug config
158 158
     |-----------------------------------------------------------------------------------------------------------
159 159
     |
160 160
     */
161
-    'debug'             => [
162
-        'debug_key'         => 'debug',
163
-        'exception_handler' => [
164
-            'trace_key'     => 'trace',
165
-            'trace_enabled' => env('APP_DEBUG', false),
166
-        ],
167
-    ],
161
+	'debug'             => [
162
+		'debug_key'         => 'debug',
163
+		'exception_handler' => [
164
+			'trace_key'     => 'trace',
165
+			'trace_enabled' => env('APP_DEBUG', false),
166
+		],
167
+	],
168 168
 
169 169
 ];
Please login to merge, or discard this patch.