Passed
Push — master ( ead934...358e50 )
by Aimeos
03:20
created

Sites::tca()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 17
rs 9.9666
1
<?php
2
3
namespace \Aimeos\Aimeos\Custom;
0 ignored issues
show
Bug introduced by
The constant Aimeos\Aimeos\Custom was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
4
5
6
class Sites
7
{
8
	public function tca() : array
9
	{
10
		$sql = 'SELECT "siteid", "label", "level" FROM "mshop_locale_site" ORDER BY "nleft"';
11
		$dbm = \Aimeos\Aimeos\Base::getContext( \Aimeos\Aimeos\Base::getConfig() )->db();
12
13
		$conn = $dbm->acquire( 'db-locale' );
14
		$result = $conn->create( $sql )->execute();
15
16
		$list = [['', '']];
17
18
		while( $row = $result->fetch() ) {
19
			$list[] = [$row['label'], $row['siteid']];
20
		}
21
22
		$dbm->release( $conn, 'db-locale' );
23
24
		return $list;
25
	}
26
}