Passed
Push — master ( f4f200...434ab7 )
by Aimeos
04:46
created

CustomerAddLaravelTestData   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPreDependencies() 0 3 1
A getManager() 0 7 2
A migrate() 0 10 1
A addCustomerGroupData() 0 2 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2014-2018
6
 */
7
8
9
namespace Aimeos\MW\Setup\Task;
10
11
12
/**
13
 * Adds Laravel customer test data.
14
 */
15
class CustomerAddLaravelTestData extends \Aimeos\MW\Setup\Task\CustomerAddTestData
16
{
17
	/**
18
	 * Returns the list of task names which this task depends on.
19
	 *
20
	 * @return string[] List of task names
21
	 */
22
	public function getPreDependencies()
23
	{
24
		return ['CustomerAddTestData'];
25
	}
26
27
28
	/**
29
	 * Adds customer test data
30
	 */
31
	public function migrate()
32
	{
33
		\Aimeos\MW\Common\Base::checkClass( \Aimeos\MShop\Context\Item\Iface::class, $this->additional );
34
35
		$this->msg( 'Adding Laravel customer test data', 0 );
36
37
		$this->additional->setEditor( 'ai-laravel:unittest' );
0 ignored issues
show
Bug introduced by
The method setEditor() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
		$this->additional->/** @scrutinizer ignore-call */ 
38
                     setEditor( 'ai-laravel:unittest' );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
		$this->process( __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'customer.php' );
39
40
		$this->status( 'done' );
41
	}
42
43
44
	/**
45
	 * Returns the manager for the current setup task
46
	 *
47
	 * @param string $domain Domain name of the manager
48
	 * @return \Aimeos\MShop\Common\Manager\Iface Manager object
49
	 */
50
	protected function getManager( $domain )
51
	{
52
		if( $domain === 'customer' ) {
53
			return \Aimeos\MShop\Customer\Manager\Factory::create( $this->additional, 'Laravel' );
0 ignored issues
show
Bug introduced by
It seems like $this->additional can also be of type null; however, parameter $context of Aimeos\MShop\Customer\Manager\Factory::create() does only seem to accept Aimeos\MShop\Context\Item\Iface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

53
			return \Aimeos\MShop\Customer\Manager\Factory::create( /** @scrutinizer ignore-type */ $this->additional, 'Laravel' );
Loading history...
54
		}
55
56
		return parent::getManager( $domain );
57
	}
58
59
60
	/**
61
	 * Adds the customer group test data.
62
	 *
63
	 * @param array $testdata Associative list of key/list pairs
64
	 * @param \Aimeos\MShop\Common\Manager\Iface $customerGroupManager Customer group manager
65
	 * @throws \Aimeos\MW\Setup\Exception If a required ID is not available
66
	 */
67
	protected function addCustomerGroupData( array $testdata, \Aimeos\MShop\Common\Manager\Iface $customerGroupManager )
68
	{
69
	}
70
}
71