Passed
Push — master ( ae8cc8...b4d665 )
by Aimeos
04:50
created

Group   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A up() 0 13 4
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2023
6
 */
7
8
9
namespace Aimeos\Upscheme\Task;
10
11
12
class Group extends Base
13
{
14
	public function up()
15
	{
16
		$this->info( 'Creating group schema', 'vv' );
17
		$db = $this->db( 'db-group' );
18
19
		foreach( $this->paths( 'default/schema/group.php' ) as $filepath )
20
		{
21
			if( ( $list = include( $filepath ) ) === false ) {
22
				throw new \RuntimeException( sprintf( 'Unable to get schema from file "%1$s"', $filepath ) );
23
			}
24
25
			foreach( $list['table'] ?? [] as $name => $fcn ) {
26
				$db->table( $name, $fcn );
27
			}
28
		}
29
	}
30
}
31