DownloadTrait::populateFromLetter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
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
     * @param Record|PdfLetterTrait $letter
18
     */
19
    public function populateFromLetter($letter)
20
    {
21
        $this->id_letter = $letter->getPrimaryKey();
0 ignored issues
show
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

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