Passed
Push — master ( c9aae5...19f872 )
by Aimeos
07:51
created

Standard::body()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 52
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 14
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 52
rs 9.7998

1 Method

Rating   Name   Duplication   Size   Complexity  
A Standard::data() 0 5 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2022
6
 * @package Client
7
 * @subpackage Html
8
 */
9
10
11
namespace Aimeos\Client\Html\Catalog\Session\Seen;
12
13
14
/**
15
 * Default implementation of catalog session seen section for HTML clients.
16
 *
17
 * @package Client
18
 * @subpackage Html
19
 */
20
class Standard
21
	extends \Aimeos\Client\Html\Common\Client\Factory\Base
22
	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
23
{
24
	/**
25
	 * Sets the necessary parameter values in the view.
26
	 *
27
	 * @param \Aimeos\Base\View\Iface $view The view object which generates the HTML output
28
	 * @param array &$tags Result array for the list of tags that are associated to the output
29
	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
30
	 * @return \Aimeos\Base\View\Iface Modified view object
31
	 */
32
	public function data( \Aimeos\Base\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\Base\View\Iface
33
	{
34
		$view->seenItems = array_reverse( $this->context()->session()->get( 'aimeos/catalog/session/seen/list', [] ) );
35
36
		return parent::data( $view, $tags, $expire );
37
	}
38
39
40
	/** client/html/catalog/session/seen/template-body
41
	 * Relative path to the HTML body template of the catalog session seen client.
42
	 *
43
	 * The template file contains the HTML code and processing instructions
44
	 * to generate the result shown in the body of the frontend. The
45
	 * configuration string is the path to the template file relative
46
	 * to the templates directory (usually in client/html/templates).
47
	 *
48
	 * You can overwrite the template file configuration in extensions and
49
	 * provide alternative templates. These alternative templates should be
50
	 * named like the default one but suffixed by
51
	 * an unique name. You may use the name of your project for this. If
52
	 * you've implemented an alternative client class as well, it
53
	 * should be suffixed by the name of the new class.
54
	 *
55
	 * @param string Relative path to the template creating code for the HTML page body
56
	 * @since 2014.03
57
	 * @see client/html/catalog/session/seen/template-header
58
	 */
59
}
60