Commit 8d0fb916 by Klimov Paul

`VarDumper::exportAsString()` removed

parent e11ecad1
...@@ -127,24 +127,13 @@ class BaseVarDumper ...@@ -127,24 +127,13 @@ class BaseVarDumper
} }
/** /**
* Outputs a parsable string representation of a variable.
* This method achieves the similar functionality as var_export
* but is more robust when handling arrays and objects.
* @param mixed $var variable to be exported.
*/
public static function export($var)
{
echo static::exportAsString($var);
}
/**
* Returns a parsable string representation of a variable. * Returns a parsable string representation of a variable.
* This method achieves the similar functionality as var_export * This method achieves the similar functionality as var_export
* but is more robust when handling arrays and objects. * but is more robust when handling arrays and objects.
* @param mixed $var variable to be exported. * @param mixed $var variable to be exported.
* @return string parsable string representation of a variable. * @return string parsable string representation of a variable.
*/ */
public static function exportAsString($var) public static function export($var)
{ {
self::$_output = ''; self::$_output = '';
self::exportInternal($var, 0); self::exportInternal($var, 0);
......
...@@ -102,6 +102,8 @@ RESULT; ...@@ -102,6 +102,8 @@ RESULT;
*/ */
public function testExport($var, $expectedResult) public function testExport($var, $expectedResult)
{ {
$this->assertEquals($expectedResult, VarDumper::exportAsString($var)); $exportResult = VarDumper::export($var);
$this->assertEquals($expectedResult, $exportResult);
$this->assertEquals($var, eval('return ' . $exportResult . ';'));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment