Beispiel #1
0
 /**
  * This method logs any changes between the source and target objects.
  *
  * @access protected
  * @param Common\IList $source                              the source object to be evaluated
  * @param Common\IList $target                              the target object to be evaluated
  * @param string $path                                      the current path
  * @param Common\Mutable\IList $log                         a reference to the log
  */
 protected function compareLists(Common\IList $source, Common\IList $target, $path, Common\Mutable\IList $log)
 {
     foreach ($source as $index => $source_value) {
         $new_path = static::buildPath($path, $index);
         if ($this->doLog($new_path)) {
             if ($target->hasIndex($index)) {
                 $target_value = $target->getValue($index);
                 if ($source_value instanceof Common\IList && $target_value instanceof Common\IList) {
                     $this->compareLists($source_value, $target_value, $new_path, $log);
                 } else {
                     if ($source_value instanceof Common\IMap && $target_value instanceof Common\IMap) {
                         $this->compareMaps($source_value, $target_value, $new_path, $log);
                     } else {
                         $this->compareValues($source_value, $target_value, $new_path, $log);
                     }
                 }
             } else {
                 $log->addValue(array('body' => strtr('Target index ":index" is missing in list.', array(':index' => $index)), 'level' => Log\Level::warning()->__name(), 'path' => $new_path, 'time' => date('c')));
             }
         }
     }
 }