File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 2626 }
2727 },
2828 "require" : {
29- "php" : " >=5.4.8 " ,
29+ "php" : " >=5.3.23 " ,
3030 "zendframework/zend-eventmanager" : " ~2.3-dev" ,
3131 "zendframework/zend-json" : " ~2.3-dev" ,
3232 "zendframework/zend-mvc" : " ~2.3-dev" ,
Original file line number Diff line number Diff line change 1313 */
1414class ApiProblemResponse extends Response
1515{
16+ /**
17+ * @var ApiProblem
18+ */
1619 protected $ apiProblem ;
1720
21+ /**
22+ * Flags to use with json_encode
23+ *
24+ * @var int
25+ */
26+ protected $ jsonFlags = 0 ;
27+
1828 /**
1929 * @param ApiProblem $apiProblem
2030 */
@@ -23,6 +33,10 @@ public function __construct(ApiProblem $apiProblem)
2333 $ this ->apiProblem = $ apiProblem ;
2434 $ this ->setStatusCode ($ apiProblem ->status );
2535 $ this ->setReasonPhrase ($ apiProblem ->title );
36+
37+ if (defined ('JSON_UNESCAPED_SLASHES ' )) {
38+ $ this ->jsonFlags = constant ('JSON_UNESCAPED_SLASHES ' );
39+ }
2640 }
2741
2842 /**
@@ -42,7 +56,7 @@ public function getApiProblem()
4256 */
4357 public function getContent ()
4458 {
45- return json_encode ($ this ->apiProblem ->toArray (), JSON_UNESCAPED_SLASHES );
59+ return json_encode ($ this ->apiProblem ->toArray (), $ this -> jsonFlags );
4660 }
4761
4862 /**
You can’t perform that action at this time.
0 commit comments