Passed
Push — bouncer-from-strings ( 831a9e...147aba )
by Daniel
11:13
created

BouncerFactory::createDeny()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 * This file is part of the theroadbunch/bouncer package.
5
 *
6
 * (c) Dan McAdams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RoadBunch\Bouncer;
13
14
15
use JetBrains\PhpStorm\Deprecated;
16
17
/**
18
 * Class BouncerFactory
19
 *
20
 * @author Dan McAdams <[email protected]>
21
 */
22
#[Deprecated(
23
    reason: 'Documentation will be removed in v2.4. Use Bouncer::allow or Bouncer::deny instead',
24
    replacement: "Use Bouncer::allow or Bouncer::deny instead"
25
)]
26
class BouncerFactory
27
{
28
    public static function create(Rule $rule, array|string $subjects = []): BouncerInterface
29
    {
30
        return match ($rule) {
31
            Rule::ALLOW => new AllowBouncer($subjects),
32
            Rule::DENY => new DenyBouncer($subjects),
33
        };
34
    }
35
}
36