EscapeTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A escape() 0 3 1
A mkString() 0 3 1
1
<?php
2
3
namespace donatj\MySqlSchema\Traits;
4
5
trait EscapeTrait {
6
7
	/**
8
	 * @param string $input
9
	 * @param string $wrapChar
10
	 * @return mixed
11
	 */
12
	protected function escape( $input, $wrapChar = '`' ) {
13
		return str_replace($wrapChar, $wrapChar . $wrapChar, $input);
14
	}
15
16
	/**
17
	 * @param string $input
18
	 * @param string $wrapChar
19
	 * @return string
20
	 */
21
	protected function mkString( $input, $wrapChar = '`' ) {
22
		return $wrapChar . $this->escape($input, $wrapChar) . $wrapChar;
23
	}
24
}
25