Example #1
0
 /**
  * This method logs any changes between the source and target values.
  *
  * @access protected
  * @param mixed $source                                     the source value to be evaluated
  * @param mixed $target                                     the target value to be evaluated
  * @param string $path                                      the current path
  * @param Common\Mutable\IList $log                         a reference to the log
  */
 protected function compareValues($source, $target, $path, Common\Mutable\IList $log)
 {
     $source_info = Core\DataType::info($source);
     $target_info = Core\DataType::info($target);
     if ($source_info->hash != $target_info->hash) {
         if ($source_info->type != $target_info->type) {
             $log->addValue(array('body' => strtr('Target value is of ":target" type, but source value is of ":source" type.', array(':source' => $source_info->type, ':target' => $target_info->type)), 'level' => Log\Level::warning()->__name(), 'path' => $path, 'time' => date('c')));
         } else {
             $log->addValue(array('body' => strtr('Target value ":target" is different from source value ":source".', array(':source' => Core\Convert::toString($source), ':target' => Core\Convert::toString($target))), 'level' => Log\Level::warning()->__name(), 'path' => $path, 'time' => date('c')));
         }
     }
 }
Example #2
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     $this->level = Log\Level::informational();
     $this->logger = Log\Manager::instance();
 }