switch ($format) {
case 'camel':
$camelCase = '';
- foreach (preg_split('/[-_ ]/', $fileBaseName, NULL, PREG_SPLIT_NO_EMPTY) as $shortNamePart) {
+ foreach (preg_split('/[-_ ]/', $fileBaseName, -1, PREG_SPLIT_NO_EMPTY) as $shortNamePart) {
$camelCase .= ucfirst($shortNamePart);
}
return strtolower($camelCase[0]) . substr($camelCase, 1);
case 'dash':
- return strtolower(implode('-', preg_split('/[-_ ]|(?=[A-Z])/', $fileBaseName, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
+ return strtolower(implode('-', preg_split('/[-_ ]|(?=[A-Z])/', $fileBaseName, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
default:
throw new \Exception("Unrecognized format");
$formValues['table'] = $this->getFieldValue($formValues, 'table', 'String');
$this->_table = $formValues['table'];
- $formValues['text'] = trim($this->getFieldValue($formValues, 'text', 'String', ''));
+ $formValues['text'] = trim($this->getFieldValue($formValues, 'text', 'String', '') ?? '');
$this->_text = $formValues['text'];
if (!$this->_table) {
return;
}
- $tag = $this->values['tag'] ?? NULL;
+ $tag = $this->values['tag'] ?? '';
if ('linkContact:' === substr($tag, 0, 12)) {
$this->values['contact_id'] = substr($tag, 12);
* @return string
*/
private function replaceTokens($tokenExpr, $data, $format, $index = 0) {
- if (strpos($tokenExpr, '[') !== FALSE) {
+ if (strpos(($tokenExpr ?? ''), '[') !== FALSE) {
foreach ($this->getTokens($tokenExpr) as $token) {
$val = $data[$token] ?? NULL;
if (isset($val) && $format === 'view') {
if ($format === 'url' && (!isset($replacement) || $replacement === '')) {
return NULL;
}
- $tokenExpr = str_replace('[' . $token . ']', $replacement, $tokenExpr);
+ $tokenExpr = str_replace('[' . $token . ']', ($replacement ?? ''), ($tokenExpr ?? ''));
}
}
return $tokenExpr;