You are here

public function Factory::getComparatorFor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/comparator/src/Factory.php \SebastianBergmann\Comparator\Factory::getComparatorFor()

Returns the correct comparator for comparing two values.

Parameters

mixed $expected The first value to compare:

mixed $actual The second value to compare:

Return value

Comparator

File

vendor/sebastian/comparator/src/Factory.php, line 66

Class

Factory
Factory for comparators which compare values for equality.

Namespace

SebastianBergmann\Comparator

Code

public function getComparatorFor($expected, $actual) {
  foreach ($this->comparators as $comparator) {
    if ($comparator
      ->accepts($expected, $actual)) {
      return $comparator;
    }
  }
}