This file ( 1kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
<?php
/*
* This file is part of the Gitter library.
*
* (c) Klaus Silveira <klaussilveira@php.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Gitter;
class PrettyFormat
{
public function parse($output)
{
if (empty($output)) {
throw new \RuntimeException('No data available');
}
try {
$xml = new \SimpleXmlIterator("<data>$output</data>");
} catch (\Exception $e) {
$output = $this->escapeXml($output);
$xml = new \SimpleXmlIterator("<data>$output</data>");
}
$data = $this->iteratorToArray($xml);
return $data['item'];
}
public function escapeXml($output)
{
return preg_replace('/[\x00-\x1f]/', '?', $output);
}
protected function iteratorToArray($iterator)
{
foreach ($iterator as $key => $item) {
if ($iterator->hasChildren()) {
$data[$key][] = $this->iteratorToArray($item);
continue;
}
$data[$key] = trim(strval($item));
}
return $data;
}
}