SampleTokenGenerator::generateToken()   A
last analyzed

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 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Translation\Tokens;
4
5
/**
6
 * A nice interface for providing tokens.
7
 */
8
class SampleTokenGenerator implements TokenProviderInterface
9
{
10
    /**
11
     * Generate a fake token just as an example.
12
     *
13
     * @param  string $source Source language
14
     * @param  string $target Target langiage
15
     * @param  string $text   Text to translate
16
     * @return string Token
17
     */
18
    public function generateToken(string $source, string $target, string $text) : string
19
    {
20
        return sprintf('%d.%d', rand(10000, 99999), rand(10000, 99999));
21
    }
22
}
23