Passed
Push — master ( 671b4b...06a963 )
by Gabriel
04:41
created

DownloadTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 2
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 3
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A populateFromLetter() 0 3 1
1
<?php
2
3
namespace ByTIC\DocumentGenerator\PdfLetters\Models\Downloads;
4
5
use ByTIC\DocumentGenerator\PdfLetters\Models\PdfLetters\PdfLetterTrait;
6
use Nip\Records\Record;
7
8
/**
9
 * Class DownloadTrait
10
 * @package ByTIC\DocumentGenerator\PdfLetters\Models\Downloads
11
 *
12
 * @property string $datetime
13
 */
14
trait DownloadTrait
15
{
16
17
    /**
18
     * @param Record|PdfLetterTrait $letter
19
     */
20
    public function populateFromLetter($letter)
21
    {
22
        $this->id_letter = $letter->getPrimaryKey();
0 ignored issues
show
Bug Best Practice introduced by
The property id_letter does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
Bug introduced by
It seems like getPrimaryKey() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        /** @scrutinizer ignore-call */ 
23
        $this->id_letter = $letter->getPrimaryKey();
Loading history...
23
    }
24
25
    /**
26
     * @param Record $recipient
27
     * @return void
28
     */
29
    abstract public function populateFromRecipient($recipient);
30
}
31