packages/ztd-query-core/tests/Fake/FakeIdentifierQuoter.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Fake;
6
7use ZtdQuery\Platform\IdentifierQuoter;
8
9/**
10 * Fake IdentifierQuoter using double-quote style.
11 */
12final class FakeIdentifierQuoter implements IdentifierQuoter
13{
14    /**
15     * Quote.
16     *
17     * @param string $identifier
18     * @return string
19     */
20    public function quote(string $identifier): string
21    {
22        $escaped = str_replace('"', '""', $identifier);
23
24        return '"' . $escaped . '"';
25    }
26}
27