Passed
Push — master ( 9253d7...e42fcd )
by Sebastian
03:09
created

Mailcode_Parser_Statement_Tokenizer_Process_ExtractTokens   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A _process() 0 25 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Mailcode;
6
7
use AppUtils\ConvertHelper;
8
9
class Mailcode_Parser_Statement_Tokenizer_Process_ExtractTokens extends Mailcode_Parser_Statement_Tokenizer_Process
10
{
11
    protected function _process() : void
12
    {
13
        // split the string by the delimiters: this gives an
14
        // array with tokenIDs, and any content that may be left
15
        // over that could not be tokenized.
16
        $parts = ConvertHelper::explodeTrim($this->delimiter, $this->tokenized);
17
        $tokens = array();
18
19
        foreach($parts as $part)
20
        {
21
            $token = $this->getTokenByID($part);
22
23
            // if the entry is a token, simply add it.
24
            if($token)
25
            {
26
                $tokens[] = $token;
27
            }
28
            // anything else is added as an unknown token.
29
            else
30
            {
31
                $tokens[] = $this->createToken('Unknown', $part);
32
            }
33
        }
34
35
        $this->tokensTemporary = $tokens;
36
    }
37
}
38