Database::bindParamArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 3
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
}