vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Prophecy\Util;
use Prophecy\Prophecy\ProphecyInterface;
use SebastianBergmann\RecursionContext\Context;
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This class is a modification from sebastianbergmann/exporter
* @see https://github.com/sebastianbergmann/exporter
*/
class ExportUtil
{
/**
* Exports a value as a string
*
* The output of this method is similar to the output of print_r(), but
* improved in various aspects:
*
* - NULL is rendered as "null" (instead of "")
* - TRUE is rendered as "true" (instead of "1")
* - FALSE is rendered as "false" (instead of "")
* - Strings are always quoted with single quotes
* - Carriage returns and newlines are normalized to \n
* - Recursion and repeated rendering is treated properly
*
* @param mixed $value
* @param int $indentation The indentation level of the 2nd+ line
* @return string
*/
public static function export($value, $indentation = 0)
{
return self::recursiveExport($value, $indentation);
}
/**
* Converts an object to an array containing all of its private, protected
* and public properties.
*
* @param mixed $value
* @return array
*/
public static function toArray($value)
{
if (!is_object($value)) {
return (array) $value;
}
$array = array();
foreach ((array) $value as $key => $val) {
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。