Skip to content

Commit 012015d

Browse files
author
Joan He
committed
MAGETWO-32371: Move jsonEncode and jsonDecode from core helper to framework
- Removed optional parameters from jsonEncode and jsonDecode methods
1 parent ca8bde7 commit 012015d

File tree

6 files changed

+11
-22
lines changed

6 files changed

+11
-22
lines changed

app/code/Magento/Catalog/Pricing/Render/PriceBox.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,11 @@ public function __construct(
5959
* Encode the mixed $valueToEncode into the JSON format
6060
*
6161
* @param mixed $valueToEncode
62-
* @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
63-
* @param array $options Additional options used during encoding
6462
* @return string
6563
*/
66-
public function jsonEncode($valueToEncode, $cycleCheck = false, $options = [])
64+
public function jsonEncode($valueToEncode)
6765
{
68-
return $this->jsonHelper->jsonEncode($valueToEncode, $cycleCheck, $options);
66+
return $this->jsonHelper->jsonEncode($valueToEncode);
6967
}
7068

7169
/**

lib/internal/Magento/Framework/Json/Decoder.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ class Decoder implements DecoderInterface
1313
* Decodes the given $data string which is encoded in the JSON format.
1414
*
1515
* @param string $data
16-
* @param int $objectDecodeType Optional; flag indicating how to decode
1716
* @return mixed
1817
*/
19-
public function decode($data, $objectDecodeType = \Zend_Json::TYPE_ARRAY)
18+
public function decode($data)
2019
{
2120
return \Zend_Json::decode($data);
2221
}

lib/internal/Magento/Framework/Json/DecoderInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ interface DecoderInterface
1515
* Decodes the given $data string which is encoded in the JSON format.
1616
*
1717
* @param string $data
18-
* @param int $objectDecodeType Optional; flag indicating how to decode
1918
* @return mixed
2019
*/
21-
public function decode($data, $objectDecodeType = \Zend_Json::TYPE_ARRAY);
20+
public function decode($data);
2221
}

lib/internal/Magento/Framework/Json/Encoder.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ public function __construct(\Magento\Framework\Translate\InlineInterface $transl
2626
* Encode the mixed $data into the JSON format.
2727
*
2828
* @param mixed $data
29-
* @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
30-
* @param array $options Additional options used during encoding
3129
* @return string
3230
*/
33-
public function encode($data, $cycleCheck = false, $options = [])
31+
public function encode($data)
3432
{
35-
$json = \Zend_Json::encode($data, $cycleCheck, $options);
33+
$json = \Zend_Json::encode($data);
3634
$this->translateInline->processResponseBody($json, true);
3735
return $json;
3836
}

lib/internal/Magento/Framework/Json/EncoderInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ interface EncoderInterface
1515
* Encode the mixed $data into the JSON format.
1616
*
1717
* @param mixed $data
18-
* @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
19-
* @param array $options Additional options used during encoding
2018
* @return string
2119
*/
22-
public function encode($data, $cycleCheck = false, $options = []);
20+
public function encode($data);
2321
}

lib/internal/Magento/Framework/Json/Helper/Data.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,22 @@ public function __construct(
3939
* Encode the mixed $valueToEncode into the JSON format
4040
*
4141
* @param mixed $valueToEncode
42-
* @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
43-
* @param array $options Additional options used during encoding
4442
* @return string
4543
*/
46-
public function jsonEncode($valueToEncode, $cycleCheck = false, $options = [])
44+
public function jsonEncode($valueToEncode)
4745
{
48-
return $this->jsonEncoder->encode($valueToEncode, $cycleCheck, $options);
46+
return $this->jsonEncoder->encode($valueToEncode);
4947
}
5048

5149
/**
5250
* Decodes the given $encodedValue string which is
5351
* encoded in the JSON format
5452
*
5553
* @param string $encodedValue
56-
* @param int $objectDecodeType
5754
* @return mixed
5855
*/
59-
public function jsonDecode($encodedValue, $objectDecodeType = \Zend_Json::TYPE_ARRAY)
56+
public function jsonDecode($encodedValue)
6057
{
61-
return $this->jsonDecoder->decode($encodedValue, $objectDecodeType);
58+
return $this->jsonDecoder->decode($encodedValue);
6259
}
6360
}

0 commit comments

Comments
 (0)