Passed
Push — master ( 5a582b...461cd7 )
by Thomas
02:36
created

Test_EncryptionKey::getForMember()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace LeKoala\Encrypt\Test;
4
5
use SilverStripe\Assets\File;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\ORM\DataObject;
8
9
/**
10
 * @property string $EncryptionKey
11
 * @property int $MemberID
12
 */
13
class Test_EncryptionKey extends DataObject implements TestOnly
14
{
15
    private static $table_name = 'EncryptionKey';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
16
17
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
18
        "EncryptionKey" => 'Varchar',
19
    ];
20
21
    private static $has_one = [
0 ignored issues
show
introduced by
The private property $has_one is not used, and could be removed.
Loading history...
22
        "Member" => File::class,
23
    ];
24
25
    public static function getForMember($ID)
26
    {
27
        $rec = self::get()->filter('MemberID', $ID)->first();
28
        return $rec->EncryptionKey ?? null;
29
    }
30
}
31