Spaces to tabs

This commit is contained in:
Kijin Sung 2020-06-12 23:49:33 +09:00
parent e6c61c4042
commit eb2c9d0aed
2 changed files with 305 additions and 305 deletions

View file

@ -24,20 +24,20 @@ class ModuleActionParser
* Load an XML file.
*
* @param string $filename
* @return object|null
* @return object
*/
public static function loadXML(string $filename): ?object
public static function loadXML(string $filename): object
{
// Get the current language.
$lang = \Context::getLangType();
// Load the XML file.
$xml = simplexml_load_file($filename);
if ($xml === false)
{
return null;
return new \stdClass;
}
// Get the current language.
$lang = \Context::getLangType();
// Initialize the module definition.
$info = new \stdClass;
$info->admin_index_act = '';
@ -213,9 +213,9 @@ class ModuleActionParser
* @param SimpleXMLElement $parent
* @param string $tag_name
* @param string $lang
* @return string|null
* @return string
*/
protected static function _getElementsByLang(\SimpleXMLElement $parent, string $tag_name, string $lang): ?string
protected static function _getElementsByLang(\SimpleXMLElement $parent, string $tag_name, string $lang): string
{
// If there is a child element that matches the language, return it.
foreach ($parent->{$tag_name} as $child)
@ -233,7 +233,7 @@ class ModuleActionParser
return trim($child);
}
// If there are no child elements, return null.
return null;
// If there are no child elements, return an empty string.
return '';
}
}

View file

@ -11,23 +11,23 @@ class ModuleInfoParser
* Load an XML file.
*
* @param string $filename
* @return object|null
* @return object
*/
public static function loadXML(string $filename): ?object
public static function loadXML(string $filename): object
{
// Load the XML file.
$xml = simplexml_load_file($filename);
if ($xml === false)
{
return new \stdClass;
}
// Get the current language.
$lang = \Context::getLangType();
// Initialize the module definition.
$info = new \stdClass;
// Load the XML file.
$xml = simplexml_load_file($filename);
if ($xml === false)
{
return null;
}
// Get the XML schema version.
$version = strval($xml['version']) ?: '0.1';
@ -94,9 +94,9 @@ class ModuleInfoParser
* @param SimpleXMLElement $parent
* @param string $tag_name
* @param string $lang
* @return string|null
* @return string
*/
protected static function _getElementsByLang(\SimpleXMLElement $parent, string $tag_name, string $lang): ?string
protected static function _getElementsByLang(\SimpleXMLElement $parent, string $tag_name, string $lang): string
{
// If there is a child element that matches the language, return it.
foreach ($parent->{$tag_name} as $child)
@ -114,7 +114,7 @@ class ModuleInfoParser
return trim($child);
}
// If there are no child elements, return null.
return null;
// If there are no child elements, return an empty string.
return '';
}
}