Database   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 0
cbo 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A bindParamArray() 0 10 2
1
<?php
2
namespace Kineo\Component;
3
4
class Database extends \PDO
5
{	
0 ignored issues
show
Coding Style introduced by
The opening class brace should be on a newline by itself.
Loading history...
6
	public function __construct($emulatePrepares = false) 
7
	{
8
		parent::__construct('mysql:host=' . MYSQL_HOST . ';dbname=' . MYSQL_DATABASE . ';charset=utf8', MYSQL_USER, MYSQL_PASSWORD);
9
		
10
		$this->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
11
		$this->setAttribute(\PDO::ATTR_EMULATE_PREPARES, $emulatePrepares);
12
	}
13
	
14
	public static function bindParamArray($prefix, $values, &$bindArray)
15
	{
16
		$str = '';
17
		foreach($values as $index => $value){
18
			$str .= ':' . $prefix . $index . ',';
19
			$bindArray[$prefix . $index] = $value; 
20
		}
21
		
22
		return rtrim($str, ',');
23
	}
24
}