Atomic   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 4 1
1
<?php
2
/*
3
 * This file is part of Rivescript-php
4
 *
5
 * (c) Shea Lewis <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Axiom\Rivescript\Cortex\Triggers;
12
13
use Axiom\Rivescript\Cortex\Input;
14
15
/**
16
 * Atomic class
17
 *
18
 * The Atomic class determines if a provided trigger
19
 * is a wildcard.
20
 *
21
 * PHP version 7.4 and higher.
22
 *
23
 * @category Core
24
 * @package  Cortext\Triggers
25
 * @author   Shea Lewis <[email protected]>
26
 * @license  https://opensource.org/licenses/MIT MIT
27
 * @link     https://github.com/axiom-labs/rivescript-php
28
 * @since    0.3.0
29
 */
30
class Atomic extends Trigger
31
{
32
33
    /**
34
     * Parse the trigger.
35
     *
36
     * @param string $trigger The trigger to parse.
37
     * @param Input  $input   Input information.
38
     *
39
     * @return bool
40
     */
41
    public function parse(string $trigger, Input $input): bool
42
    {
43
        $trigger = $this->parseTags($trigger, $input);
44
        return strtolower($trigger) === $input->source();
45
    }
46
}
47