/** * Comare charObjects to congruous * * @param string $str * @param boolean $print * @return boolean */ private function checkCharObject($str, $print = true) { $m = 1; $char = unserialize($str); if ($print) { echo "Check '" . $char->getName() . "'<br/>"; } $curr_imgs_info = $char->getImageInfo(); $imageInfo = $this->charObject->getImageInfo(); if (count($imageInfo)) { $m = 0; foreach ($imageInfo as $key => $value) { if (isset($curr_imgs_info[$key]['type']) && ($curr_imgs_info[$key]['type'] != $value['type'] && $curr_imgs_info[$key]['type'] != OCR::getNegative($value['type']))) { $m++; } } } if ($print) { echo "We have " . $m . " errors <br/>"; } if ($m == 0) { if ($print) { echo "It is '" . $char->getName() . "'<br/>"; } return true; } else { if ($print) { echo "It is not '" . $char->getName() . "'<br/>"; } return false; } }