Mercurial > hg > isophonics-drupal-site
annotate vendor/sebastian/comparator/src/ExceptionComparator.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 1fec387a4317 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 /* |
Chris@14 | 3 * This file is part of sebastian/comparator. |
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@14 | 21 * @param mixed $expected The first value to compare |
Chris@14 | 22 * @param mixed $actual The second value to compare |
Chris@14 | 23 * |
Chris@0 | 24 * @return bool |
Chris@0 | 25 */ |
Chris@0 | 26 public function accepts($expected, $actual) |
Chris@0 | 27 { |
Chris@0 | 28 return $expected instanceof \Exception && $actual instanceof \Exception; |
Chris@0 | 29 } |
Chris@0 | 30 |
Chris@0 | 31 /** |
Chris@0 | 32 * Converts an object to an array containing all of its private, protected |
Chris@0 | 33 * and public properties. |
Chris@0 | 34 * |
Chris@14 | 35 * @param object $object |
Chris@14 | 36 * |
Chris@0 | 37 * @return array |
Chris@0 | 38 */ |
Chris@0 | 39 protected function toArray($object) |
Chris@0 | 40 { |
Chris@0 | 41 $array = parent::toArray($object); |
Chris@0 | 42 |
Chris@0 | 43 unset( |
Chris@0 | 44 $array['file'], |
Chris@0 | 45 $array['line'], |
Chris@0 | 46 $array['trace'], |
Chris@0 | 47 $array['string'], |
Chris@0 | 48 $array['xdebug_message'] |
Chris@0 | 49 ); |
Chris@0 | 50 |
Chris@0 | 51 return $array; |
Chris@0 | 52 } |
Chris@0 | 53 } |