Completed
Push — master ( 8238b8...39728a )
by Aimeos
01:53
created

Factory::createClientRoot()   B

Complexity

Conditions 4
Paths 6

Size

Total Lines 134

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 134
rs 8
c 0
b 0
f 0
cc 4
nc 6
nop 4

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-2018
6
 * @package Admin
7
 * @subpackage JsonAdm
8
 */
9
10
11
namespace Aimeos\Admin\JsonAdm;
12
13
14
/**
15
 * Factory which can create all JSON API clients
16
 *
17
 * @package Admin
18
 * @subpackage JsonAdm
19
 * @deprecated Use JsonAdm class instead
20
 */
21
class Factory
22
	extends \Aimeos\Admin\JsonAdm
23
	implements \Aimeos\Admin\JsonAdm\Common\Factory\Iface
24
{
25
	/**
26
	 * Creates the required client specified by the given path of client names.
27
	 *
28
	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object required by clients
29
	 * @param \Aimeos\Bootstrap $aimeos Aimeos Bootstrap object
30
	 * @param string $path Name of the client separated by slashes, e.g "product/property"
31
	 * @param string|null $name Name of the client implementation ("Standard" if null)
32
	 * @return \Aimeos\Admin\JsonAdm\Iface JSON admin instance
33
	 * @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
34
	 */
35
	static public function createClient( \Aimeos\MShop\Context\Item\Iface $context,
36
		\Aimeos\Bootstrap $aimeos, $path, $name = null )
37
	{
38
		return self::create( $context, $aimeos, $path, $name );
39
	}
40
41
42
	/**
43
	 * Enables or disables caching of class instances.
44
	 *
45
	 * @param boolean $value True to enable caching, false to disable it.
46
	 * @return boolean Previous cache setting
47
	 */
48
	static public function setCache( $value )
49
	{
50
		return self::cache( $value );
51
	}
52
}
53