Example #1
0
File: XML.php Project: ksst/kf
 /**
  * Read the config array from xml file.
  *
  * @param   string  The filename
  * @param string $file
  *
  * @return mixed array | boolean false
  */
 public static function read($file)
 {
     if (is_file($file) === false or is_readable($file) === false) {
         throw new \InvalidArgumentException('XML File ' . $file . ' not existing or not readable.');
     }
     $xml = simplexml_load_file($file);
     return \Koch\Datatype\XML::toArray($xml);
 }
Example #2
0
 /**
  * Read the config array from xml file
  *
  * @param   string  The filename
  * @return mixed array | boolean false
  */
 public static function readConfig($file)
 {
     if (is_file($file) === false or is_readable($file) === false) {
         throw new \Exception('XML File not existing or not readable.');
     }
     // read file
     $xml = simplexml_load_file($file);
     // transform (SimpleXMLElement or XML) to PHP Array
     return \Koch\Datatype\XML::toArray($xml);
 }