HasPaymentMethodRecord   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A populateFromPaymentMethod() 0 7 2
1
<?php
2
3
namespace ByTIC\Payments\Models\AbstractModels\HasPaymentMethod;
4
5
use ByTIC\Payments\Models\Methods\PaymentMethod;
6
7
/**
8
 * Trait HasPaymentMethodRecord
9
 * @package ByTIC\Payments\Models\AbstractModels\HasPaymentMethod
10
 *
11
 * @property int $id_method
12
 * @method PaymentMethod getPaymentMethod()
13
 */
14
trait HasPaymentMethodRecord
15
{
16
    /**
17
     * @param PaymentMethod $method
18
     */
19
    public function populateFromPaymentMethod($method)
20
    {
21
        if (is_object($method)) {
22
            $this->getRelation('PaymentMethod')->setResults($method);
0 ignored issues
show
Bug introduced by
It seems like getRelation() 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
            $this->/** @scrutinizer ignore-call */ 
23
                   getRelation('PaymentMethod')->setResults($method);
Loading history...
23
            $method = $method->id;
24
        }
25
        $this->id_method = $method;
26
    }
27
}
28