Completed
Pull Request — master (#6)
by
unknown
01:22
created

FEUsersAddSiteIdTypo3   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 61
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPreDependencies() 0 4 1
A getPostDependencies() 0 4 1
B migrate() 0 24 5
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017
6
 */
7
8
9
namespace Aimeos\MW\Setup\Task;
10
11
12
/**
13
 * Adds siteid column to fe_users table.
14
 */
15
class FEUsersAddSiteIdTypo3 extends \Aimeos\MW\Setup\Task\Base
16
{
17
	private $migrate = array(
18
		'mysql' => array (
19
			'ALTER TABLE "fe_users" ADD "siteid" INTEGER NULL'
20
		),
21
	);
22
23
24
	/**
25
	 * Returns the list of task names which this task depends on.
26
	 *
27
	 * @return array List of task names
28
	 */
29
	public function getPreDependencies()
30
	{
31
		return [];
32
	}
33
34
35
	/**
36
	 * Returns the list of task names which depends on this task.
37
	 *
38
	 * @return string[] List of task names
39
	 */
40
	public function getPostDependencies()
41
	{
42
		return array('TablesCreateTypo3');
43
	}
44
45
46
	/**
47
	 * Add column siteid to fe_users table.
48
	 *
49
	 * @param array $stmts Associative array of tables names and lists of SQL statements to execute.
0 ignored issues
show
Bug introduced by
There is no parameter named $stmts. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
50
	 */
51
	public function migrate()
52
	{
53
		$table = 'fe_users';
54
		$column = 'siteid';
55
56
		$this->msg( sprintf( 'Adding "%1$s" column to "%2$s" table', $column, $table ), 0 );
57
58
		$schema = $this->getSchema( 'db-customer' );
59
60
		if( isset( $this->migrate[$schema->getName()] )
61
			&& $schema->tableExists( $table ) === true
62
			&& $schema->columnExists( $table, $column ) === false )
63
		{
64
			foreach ( $this->migrate[$schema->getName()] as $stmt )
65
			{
66
				$this->execute( $stmt );
67
			}
68
			$this->status( 'done' );
69
		}
70
		else
71
		{
72
			$this->status( 'OK' );
73
		}
74
	}
75
}
76