/**
  * private function recXmlToVars
  * method used to unserialize the object, recursive
  * @Param (array) aProps : the array we work on recursively
  */
 private function recXmlToVars($aProps)
 {
     foreach ($aProps as $clef => $val) {
         $cpt = count($val);
         if ($cpt > 0) {
             foreach ($val as $k => $v) {
                 $cpt2 = count($v);
                 if ($cpt2 > 0) {
                     if (substr($k, 0, 7) === 'object_') {
                         foreach ($this->oPropObj as $kObj => $vObj) {
                             if ($this->oPropObj[$kObj]['class'] === substr($k, 7)) {
                                 $oXmlSerializer = new self($this->oPropObj[$kObj]['object']);
                                 $oXmlSerializer->getProps();
                                 $sXml = $oXmlSerializer->varsToXml();
                                 $oXmlSerializer->xmlToVars($sXml);
                                 $this->oObj->{$clef}[substr($k, 7)] = $oXmlSerializer->getObj();
                             }
                         }
                     } else {
                         $this->recXmlToVars($v);
                     }
                 } else {
                     if ($k[0] === '_') {
                         $k = substr($k, 1, strlen($k) - 1);
                     }
                     $this->oObj->{$clef}[$k] = current($v);
                 }
             }
         } elseif (!empty($val)) {
             $this->oObj->{$clef} = current($val);
         }
     }
 }
Example #2
0
 /**
  * Get an associative array containing information about a file in the local filesystem.
  *
  * @param string $path Absolute local filesystem path
  * @param string|bool $ext The file extension, or true to extract it from the filename.
  *   Set it to false to ignore the extension.
  * @return array
  */
 public static function getPropsFromPath($path, $ext = true)
 {
     $fsFile = new self($path);
     return $fsFile->getProps($ext);
 }