You are here

public function Factory::register in Zircon Profile 8

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

Registers a new comparator.

This comparator will be returned by getInstance() if its accept() method returns TRUE for the compared values. It has higher priority than the existing comparators, meaning that its accept() method will be tested before those of the other comparators.

Parameters

Comparator $comparator The registered comparator:

2 calls to Factory::register()
Factory::__construct in vendor/sebastian/comparator/src/Factory.php
Constructs a new factory.
Factory::__construct in vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php
Constructs a new factory.

File

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

Class

Factory
Factory for comparators which compare values for equality.

Namespace

SebastianBergmann\Comparator

Code

public function register(Comparator $comparator) {
  array_unshift($this->comparators, $comparator);
  $comparator
    ->setFactory($this);
}