HEX
Server: Apache/2.4.66 (Debian)
System: Linux 6dfabc3b2241 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User: (1000)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wp-migrate-db/class/Common/Replace/PairFactory.php
<?php

namespace DeliciousBrains\WPMDB\Common\Replace;

/**
 * Class PairFactory
 *
 * Used to create search and replace pairs instances.
 *
 * @package DeliciousBrains\WPMDB\Common\Replace
 */
class PairFactory {

    const REGEX = 'REGEX';
    const CASE_SENSITIVE = 'CASE_SENSITIVE';
    const CASE_INSENSITIVE = 'CASE_INSENSITIVE';

    /**
     * @param string $pattern
     * @param string $replace
     * @param string $type
     *
     * @return ReplacePairInterface
     */
    public function create($pattern, $replace, $type = self::CASE_INSENSITIVE) {
        switch($type) {
            case self::REGEX:
                return new RegexPair($pattern, $replace);
            case self::CASE_SENSITIVE:
                return new CaseSensitivePair($pattern, $replace);
            default:
                return new CaseInsensitivePair($pattern, $replace);
        }
    }
}