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

_process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 25
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 9
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 25
rs 9.9666
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