DownloadTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
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 15
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
     * @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