/** * @param $matches * @return mixed */ private function transformCallback($matches) { $replacement = $matches[0]; if (!empty($matches[1])) { $tmpPreparedValues = $this->preparedValues; $tmpNumberPlaceholder = $this->numberPlaceholder; $tmpIsHookSkipValue = $this->isHookSkipValue; $replacement = preg_replace_callback($this->getRegexpMain(), [$this, 'transformCallback'], $matches[1]); if ($this->isHookSkipValue) { $this->isHookSkipValue = $tmpIsHookSkipValue; $this->numberPlaceholder = $tmpNumberPlaceholder; $this->preparedValues = $tmpPreparedValues; return ''; } return $replacement; } if (!empty($matches[2])) { $this->numberPlaceholder++; $placeholder = $this->placeholders->getPlaceholder($matches[0]); if (count($this->values) == 0) { return 'ERROR_NO_VALUE'; } $value = array_shift($this->values); if ($value === Database::SKIP_VALUE) { $this->isHookSkipValue = true; } if ($this->isForceExpandValues) { $replacement = $placeholder->transformPlaceholder($value); } else { $replacement = $placeholder->transformPlaceholder($value, $this->adapter->getNativeCommonPlaceholder($this->numberPlaceholder)); $preparedValue = $placeholder->transformValue($value); if ($preparedValue !== Database::SKIP_VALUE) { if (is_array($preparedValue)) { $this->preparedValues = array_merge($this->preparedValues, $preparedValue); } else { $this->preparedValues = array_merge($this->preparedValues, [$preparedValue]); } } } } return $replacement; }