forked from Respect/Validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrefixBench.php
More file actions
42 lines (36 loc) · 1.24 KB
/
Copy pathPrefixBench.php
File metadata and controls
42 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: (c) Respect Project Contributors
* SPDX-FileContributor: Alexandre Gomes Gaigalas <alganet@gmail.com>
*/
declare(strict_types=1);
namespace Respect\Validation\Benchmarks;
use PhpBench\Attributes as Bench;
use Respect\Validation\Transformers\Prefix;
use Respect\Validation\Transformers\ValidatorSpec;
final class PrefixBench
{
/** @param array{0: Prefix, 1: ValidatorSpec} $params */
#[Bench\ParamProviders(['provideTransformerSpec'])]
#[Bench\Iterations(10)]
#[Bench\RetryThreshold(5)]
#[Bench\Revs(100)]
#[Bench\Warmup(1)]
#[Bench\Subject]
public function prefixTransformer(array $params): void
{
$params[0]->transform($params[1]);
}
/** @return array<array{0: Prefix, 1: ValidatorSpec}> */
public static function provideTransformerSpec(): array
{
return [
[new Prefix(), new ValidatorSpec('keyName', ['value', 'other'])],
[new Prefix(), new ValidatorSpec('propertyTitle', ['value', 'other'])],
[new Prefix(), new ValidatorSpec('notSomething', ['value'])],
[new Prefix(), new ValidatorSpec('not')],
[new Prefix(), new ValidatorSpec('arrayVal')],
];
}
}