/** * 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'))); } } } }
/** * This method determines whether the transition is traversable. * * @access public * @param \Unicity\Common\IList $sigma the input alphabet/sequence * @param integer $index the index to the input symbol in * the sigma * @return boolean whether the input symbol is * accepted * * @see http://www.w3.org/TR/scxml/#transition * @see http://www.w3.org/TR/scxml/#EventDescriptors * @see http://www.w3.org/TR/scxml/#SelectingTransitions */ public function isTraversable(Common\IList $sigma, $index) { if (is_callable($this->condition)) { return (bool) call_user_func_array($this->condition, array($sigma, $index)); } return (string) serialize($sigma->getValue($index)) == (string) serialize($this->condition); }