| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 62.5% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class Decorator |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Escape content with ' and wrap content with ' |
||
| 16 | * |
||
| 17 | * @param string $args |
||
| 18 | * @param string $quotes |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | 6 | public function columnDefaultToString(string $args, string $quotes = '\''): string |
|
| 22 | { |
||
| 23 | 6 | $args = addslashes($args); |
|
| 24 | // To replace from ' to \\\' |
||
| 25 | 6 | $args = str_replace($quotes, '\\\\\\\\'.$quotes, $args); |
|
| 26 | |||
| 27 | 6 | return $quotes.$args.$quotes; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get Decorator |
||
| 32 | * @param string $function |
||
| 33 | * @param array $args |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 21 | public function decorate(string $function, array $args): string |
|
| 37 | { |
||
| 38 | 21 | if (!empty($args)) { |
|
| 39 | 18 | return $function.'('.implode(', ', $args).')'; |
|
| 40 | } else { |
||
| 41 | 6 | return $function; |
|
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | 57 | public function addSlash(string $string): string |
|
| 46 | { |
||
| 47 | 57 | return addcslashes($string, "\\'"); |
|
| 48 | } |
||
| 49 | |||
| 50 | public function tableWithoutPrefix(string $table): string |
||
| 56 | } |
||
| 57 | |||
| 58 | public function tableUsedInFilename(string $table): string |
||
| 59 | { |
||
| 64 |