AssociationModel::addResult()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
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
}