Passed
Push — master ( 61b2f8...584670 )
by Chubarov
05:03
created

Product   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 27
rs 10
c 1
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPrice() 0 3 1
A getCost() 0 3 1
A getQuantity() 0 3 1
A getName() 0 3 1
A __construct() 0 4 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Fns;
5
6
class Product
7
{
8
    public function __construct(array $item)
9
    {
10
        foreach ($item as $property => $value) {
11
            $this->{$property} = $value;
12
        }
13
    }
14
15
    public function getName() : string
16
    {
17
        return $this->name;
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Fns\Product. Did you maybe forget to declare it?
Loading history...
18
    }
19
20
    public function getPrice():int
21
    {
22
        return (int)$this->price;
0 ignored issues
show
Bug Best Practice introduced by
The property price does not exist on Fns\Product. Did you maybe forget to declare it?
Loading history...
23
    }
24
25
    public function getQuantity() : int
26
    {
27
        return (int)$this->quantity;
0 ignored issues
show
Bug Best Practice introduced by
The property quantity does not exist on Fns\Product. Did you maybe forget to declare it?
Loading history...
28
    }
29
30
    public function getCost() : int
31
    {
32
        return (int)$this->sum;
0 ignored issues
show
Bug Best Practice introduced by
The property sum does not exist on Fns\Product. Did you maybe forget to declare it?
Loading history...
33
    }
34
}
35