Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace SebastianBergmann\Comparator; Chris@0: Chris@0: /** Chris@0: * Compares Exception instances for equality. Chris@0: */ Chris@0: class ExceptionComparator extends ObjectComparator Chris@0: { Chris@0: /** Chris@0: * Returns whether the comparator can compare two values. Chris@0: * Chris@14: * @param mixed $expected The first value to compare Chris@14: * @param mixed $actual The second value to compare Chris@14: * Chris@0: * @return bool Chris@0: */ Chris@0: public function accepts($expected, $actual) Chris@0: { Chris@0: return $expected instanceof \Exception && $actual instanceof \Exception; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Converts an object to an array containing all of its private, protected Chris@0: * and public properties. Chris@0: * Chris@14: * @param object $object Chris@14: * Chris@0: * @return array Chris@0: */ Chris@0: protected function toArray($object) Chris@0: { Chris@0: $array = parent::toArray($object); Chris@0: Chris@0: unset( Chris@0: $array['file'], Chris@0: $array['line'], Chris@0: $array['trace'], Chris@0: $array['string'], Chris@0: $array['xdebug_message'] Chris@0: ); Chris@0: Chris@0: return $array; Chris@0: } Chris@0: }