Passed
Push — master ( 96d33b...43186b )
by Gabriel
13:27
created

HasCustomerRecord::populateFromCustomer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace ByTIC\Payments\Models\AbstractModels\HasCustomer;
4
5
use Nip\Records\Record;
6
use ByTIC\Payments\Models\BillingRecord\Traits\RecordTrait as BillingRecord;
7
8
/**
9
 * Trait HasCustomerRecord
10
 * @package ByTIC\Payments\Models\AbstractModels\HasCustomer
11
 *
12
 * @property int $customer_id
13
 * @property string $customer_type
14
 */
15
trait HasCustomerRecord
16
{
17
    /**
18
     * @param BillingRecord|Record $customer
19
     */
20
    public function populateFromCustomer($customer)
21
    {
22
        $this->customer_id = $customer->id;
23
        $this->customer_type = $customer->getManager()->getMorphName();
0 ignored issues
show
Documentation Bug introduced by
It seems like $customer->getManager()->getMorphName() of type Nip\Records\AbstractModels\RecordManager or Nip\Records\Collections\Collection or Nip\Records\Traits\Relat...asRelationsRecordsTrait or true is incompatible with the declared type string of property $customer_type.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
Bug introduced by
It seems like getMorphName() 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

23
        $this->customer_type = $customer->getManager()->/** @scrutinizer ignore-call */ getMorphName();
Loading history...
Bug introduced by
It seems like getManager() 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

23
        $this->customer_type = $customer->/** @scrutinizer ignore-call */ getManager()->getMorphName();
Loading history...
24
    }
25
}