annotate vendor/sebastian/comparator/src/ExceptionComparator.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children 5311817fb629
rev   line source
Chris@0 1 <?php
Chris@0 2 /*
Chris@0 3 * This file is part of the Comparator package.
Chris@0 4 *
Chris@0 5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
Chris@0 6 *
Chris@0 7 * For the full copyright and license information, please view the LICENSE
Chris@0 8 * file that was distributed with this source code.
Chris@0 9 */
Chris@0 10
Chris@0 11 namespace SebastianBergmann\Comparator;
Chris@0 12
Chris@0 13 /**
Chris@0 14 * Compares Exception instances for equality.
Chris@0 15 */
Chris@0 16 class ExceptionComparator extends ObjectComparator
Chris@0 17 {
Chris@0 18 /**
Chris@0 19 * Returns whether the comparator can compare two values.
Chris@0 20 *
Chris@0 21 * @param mixed $expected The first value to compare
Chris@0 22 * @param mixed $actual The second value to compare
Chris@0 23 * @return bool
Chris@0 24 */
Chris@0 25 public function accepts($expected, $actual)
Chris@0 26 {
Chris@0 27 return $expected instanceof \Exception && $actual instanceof \Exception;
Chris@0 28 }
Chris@0 29
Chris@0 30 /**
Chris@0 31 * Converts an object to an array containing all of its private, protected
Chris@0 32 * and public properties.
Chris@0 33 *
Chris@0 34 * @param object $object
Chris@0 35 * @return array
Chris@0 36 */
Chris@0 37 protected function toArray($object)
Chris@0 38 {
Chris@0 39 $array = parent::toArray($object);
Chris@0 40
Chris@0 41 unset(
Chris@0 42 $array['file'],
Chris@0 43 $array['line'],
Chris@0 44 $array['trace'],
Chris@0 45 $array['string'],
Chris@0 46 $array['xdebug_message']
Chris@0 47 );
Chris@0 48
Chris@0 49 return $array;
Chris@0 50 }
Chris@0 51 }