mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Rename all common/framework source files to be case-sensitive
This commit is contained in:
parent
60fd7d7cf2
commit
0029d1a1ec
73 changed files with 5 additions and 5 deletions
55
common/framework/parsers/XMLRPCParser.php
Normal file
55
common/framework/parsers/XMLRPCParser.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Parsers;
|
||||
|
||||
/**
|
||||
* XMLRPC request parser class for XE compatibility.
|
||||
*/
|
||||
class XMLRPCParser
|
||||
{
|
||||
/**
|
||||
* Load an XML file.
|
||||
*
|
||||
* @param string $content
|
||||
* @return object|false
|
||||
*/
|
||||
public static function parse(string $content)
|
||||
{
|
||||
// Load the XML content.
|
||||
$xml = simplexml_load_string($content);
|
||||
if ($xml === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loop over the list of parameters.
|
||||
$result = self::_parseArray($xml->params);
|
||||
|
||||
// Return the complete result.
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an array of parameters.
|
||||
*
|
||||
* @param \SimpleXMLElement $parent
|
||||
* @return array
|
||||
*/
|
||||
protected static function _parseArray(\SimpleXMLElement $parent): array
|
||||
{
|
||||
$result = array();
|
||||
foreach ($parent->children() ?: [] as $tag)
|
||||
{
|
||||
$key = $tag->getName();
|
||||
if (strval($tag['type']) === 'array')
|
||||
{
|
||||
$result[$key] = self::_parseArray($tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result[$key] = strval($tag);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue