1<?php 2 3/* 4 * This file is part of the Prophecy. 5 * (c) Konstantin Kudryashov <ever.zet@gmail.com> 6 * Marcello Duarte <marcello.duarte@gmail.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace Prophecy\Comparator; 13 14use SebastianBergmann\Comparator\Factory as BaseFactory; 15 16/** 17 * Prophecy comparator factory. 18 * 19 * @author Konstantin Kudryashov <ever.zet@gmail.com> 20 */ 21final class Factory extends BaseFactory 22{ 23 /** 24 * @var Factory 25 */ 26 private static $instance; 27 28 public function __construct() 29 { 30 parent::__construct(); 31 32 $this->register(new ClosureComparator()); 33 $this->register(new ProphecyComparator()); 34 } 35 36 /** 37 * @return Factory 38 */ 39 public static function getInstance() 40 { 41 if (self::$instance === null) { 42 self::$instance = new Factory; 43 } 44 45 return self::$instance; 46 } 47} 48