Passed
Push — master ( 54ca64...d44c58 )
by Aimeos
04:37
created

Cache   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A save() 0 12 2
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2020
6
 * @package Admin
7
 * @subpackage JQAdm
8
 */
9
10
11
namespace Aimeos\Admin\JQAdm\Product\Supplier\Decorator;
12
13
14
/**
15
 * Cache cleanup decorator for product category JQAdm client
16
 *
17
 * @package Admin
18
 * @subpackage JQAdm
19
 */
20
class Cache extends \Aimeos\Admin\JQAdm\Common\Decorator\Base
21
{
22
	/**
23
	 * Clears the cache after saving the item
24
	 *
25
	 * @return string|null Output to display or null for none
26
	 */
27
	public function save() : ?string
28
	{
29
		$result = $this->getClient()->save();
30
		$tags = ['supplier'];
31
32
		foreach( $this->getView()->param( 'supplier', [] ) as $entry ) {
33
			$tags[] = 'supplier-' . $entry['supplier.id'];
34
		}
35
36
		$this->getContext()->getCache()->deleteByTags( $tags );
37
38
		return $result;
39
	}
40
}
41