src/Peach/DF/JsonCodec.php
private function encodeArray(array $arr)
    {
        $prettyPrintEnabled = $this->getEncodeOption(self::PRETTY_PRINT);
        
        $indent   = $prettyPrintEnabled ? PHP_EOL . "    " : "";
        $start    = "[" . $indent;
        $end      = $prettyPrintEnabled ? PHP_EOL . "]" : "]";
        $self     = $this;
        $callback = function ($value) use ($self, $prettyPrintEnabled, $indent) {
            $valueResult = $self->encodeValue($value);
            return $prettyPrintEnabled ? str_replace(PHP_EOL, $indent, $valueResult) : $valueResult;
        };
        return $start . implode("," . $indent, array_map($callback, $arr)) . $end;
    }
private function encodeArray(array $arr)
    {
        $prettyPrintEnabled = $this->getEncodeOption(self::PRETTY_PRINT);
        
        $indent   = $prettyPrintEnabled ? PHP_EOL . "    " : "";
        $start    = "[" . $indent;
        $end      = $prettyPrintEnabled ? PHP_EOL . "]" : "]";
        $self     = $this;
        $callback = function ($value) use ($self, $prettyPrintEnabled, $indent) {
            $valueResult = $self->encodeValue($value);
            return $prettyPrintEnabled ? str_replace(PHP_EOL, $indent, $valueResult) : $valueResult;
        };
        return $start . implode("," . $indent, array_map($callback, $arr)) . $end;
    }
指定された配列を JSON の array 表記に変換します.
オプション PRETTY_PRINT が有効化されている場合,
json_encode の JSON_PRETTY_PRINT と同様に半角スペース 4 個と改行文字で整形します.

@param  array  $arr 変換対象
@return string      JSON 文字列