Completed
Pull Request — master (#197)
by
unknown
02:04
created

GoodsReceipts::addItem()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 5

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
dl 11
loc 11
rs 9.2
c 0
b 0
f 0
cc 4
eloc 5
nc 4
nop 1
1
<?php 
2
3
namespace Picqer\Financials\Exact;
4
5
/**
6
 * Class GoodsReceipts
7
 *
8
 * @package Picqer\Financials\Exact
9
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=GoodsReceipts
10
 *
11
 * @property Guid $ID Primary key
12
 * @property DateTime $Created Creation date
13
 * @property Guid $Creator User ID of creator 
14
 * @property String $CreatorFullName Name of creator
15
 * @property String $Description Description of the goods receipt
16
 * @property Int32 $Division Division code
17
 * @property Guid $Document Document that is manually linked to the goods receipt 
18
 * @property String $DocumentSubject Subject of the document 
19
 * @property Int32 $EntryNumber Entry number of the resulting stock entry 
20
 * @property GoodsReceiptLines $GoodsReceiptLines Collection of lines
21
 * @property DateTime $Modified Last modified date
22
 * @property Guid $Modifier User ID of modifier    
23
 * @property String $ModifierFullName Name of modifier 
24
 * @property DateTime $ReceiptDate Date of the goods receipt
25
 * @property Int32 $ReceiptNumber Receipt number  
26
 * @property String $Remarks Receipt note
27
 * @property Guid $Supplier Account ID of the supplier
28
 * @property String $SupplierCode Code of supplier 
29
 * @property Guid $SupplierContact ID of the contact person at the supplier
30
 * @property String $SupplierContactPersonFullName 	Name of the contact person at the supplier
31
 * @property String $SupplierName Name of supplier  
32
 * @property Guid $Warehouse Warehouse
33
 * @property String $WarehouseCode Code of Warehouse 
34
 * @property String $WarehouseDescription Description of Warehouse 
35
 * @property String $YourRef The purchase invoice number provided by the supplier 
36
 */
37
class GoodsReceipts extends Model
38
{
39
    use Query\Findable;
40
    use Persistance\Storable;
41
42
    protected $primaryKey = 'ID';
43
44
    protected $GoodsReceiptLines = [];
45
46
    protected $fillable = [
47
        'ID',
48
        'Created',
49
        'Creator',
50
        'CreatorFullName',
51
        'Description',
52
        'Division',
53
        'Document',
54
        'DocumentSubject',
55
        'EntryNumber',
56
        'GoodsReceiptLines',
57
        'Modified',
58
        'Modifier',
59
        'ModifierFullName',
60
        'ReceiptDate',
61
        'ReceiptNumber',
62
        'Remarks',
63
        'Supplier',
64
        'SupplierCode',
65
        'SupplierContact',
66
        'SupplierContactPersonFullName',
67
        'SupplierName',
68
        'Warehouse',
69
        'WarehouseCode',
70
        'WarehouseDescription',
71
        'YourRef',
72
    ];
73
74 View Code Duplication
    public function addItem(array $array)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
75
    {
76
        if ( ! isset($this->attributes['GoodsReceiptLines']) || $this->attributes['GoodsReceiptLines'] == null)
77
        {
78
            $this->attributes['GoodsReceiptLines'] = [];
79
        }
80
        if ( ! isset($array['LineNumber']))
81
        {
82
            $array['LineNumber'] = count($this->attributes['GoodsReceiptLines']) + 1;
83
        }
84
        $this->attributes['GoodsReceiptLines'][] = $array;
85
    }
86
87
88
    protected $url = 'purchaseorder/GoodsReceipts';
89
90
}
91