Completed
Push — master ( ac66b3...ab3b6f )
by Aimeos
07:35 queued 01:23
created

Ezpublish::setEzUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016
6
 * @package MShop
7
 * @subpackage Context
8
 */
9
10
11
namespace Aimeos\MShop\Context\Item;
12
13
14
/**
15
 * Common objects which must to be available for all manager objects
16
 *
17
 * @package MShop
18
 * @subpackage Context
19
 */
20
class Ezpublish extends \Aimeos\MShop\Context\Item\Standard
21
{
22
	private $ezUser;
23
24
25
	/**
26
	 * Sets the user creating function
27
	 *
28
	 * @param \Closure $userfcn Function to create a new user and return its ID
29
	 * @return \Aimeos\MShop\Context\Item\Iface Context item for chaining method calls
30
	 */
31
	public function setEzUser( \Closure $userfcn )
32
	{
33
		$this->ezUser = $userfcn;
34
		return $this;
35
	}
36
37
38
	/**
39
	 * Returns the user creating function
40
	 *
41
	 * @return \Closure Function to create a new user and return its ID
42
	 */
43
	public function getEzUser()
44
	{
45
		if( !isset( $this->ezUser ) ) {
46
			throw new \Aimeos\MShop\Exception( sprintf( 'eZ user function not available' ) );
47
		}
48
49
		return $this->ezUser;
50
	}
51
}
52