Indexer::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
3
/**
4
 * Created by PhpStorm.
5
 * User: gordon
6
 * Date: 24/3/2561
7
 * Time: 20:36 น.
8
 */
9
10
namespace Suilven\FreeTextSearch\Tests\Mock;
11
12
use SilverStripe\ORM\DataObject;
13
14
// @phpcs:disable SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
15
class Indexer extends \Suilven\FreeTextSearch\Base\Indexer implements \Suilven\FreeTextSearch\Interfaces\Indexer
16
{
17
    /** @var array<string, (string|int|float|bool)>|null */
18
    private static $payload = [];
19
20
21
    // @phpstan-ignore-next-line
22
    public function index(DataObject $dataObject): void
23
    {
24
        self::$payload[] = $this->getIndexablePayload($dataObject);
25
    }
26
27
28
    /** @return array<string, (string|int|float|bool)>|null */
29
    public static function getIndexedPayload(): ?array
30
    {
31
        return self::$payload;
32
    }
33
34
35
    public static function resetIndexedPayload(): void
36
    {
37
        self::$payload = [];
38
    }
39
}
40