AssociationModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addResult() 0 4 1
A getResult() 0 4 1
1
<?php
2
3
namespace Predictator\AssociationRule;
4
5
6
class AssociationModel implements AssociationModelInterface
7
{
8
	/**
9
	 * @var ResultSet[]
10
	 */
11
	private $result = [];
12
13
	/**
14
	 * @param ProductInterface $product
15
	 * @param ResultSet $result
16
	 */
17
	public function addResult(ProductInterface $product, ResultSet $result)
18
	{
19
		$this->result[$product->getId()] = $result;
20
	}
21
22
	/**
23
	 * @param ProductInterface $product
24
	 * @return ResultSet
25
	 */
26
	public function getResult(ProductInterface $product): ResultSet
27
	{
28
		return $this->result[$product->getId()] ?? new ResultSet();
29
	}
30
}