/** * Remove the datasource's prefix from the given table name and return the remaining part * * @param array|string $table * * @return array|string * * @throws IcingaException In case $table is not of a supported type */ protected function removeTablePrefix($table) { $prefix = $this->ds->getTablePrefix(); if (!$prefix) { return $table; } if (is_array($table)) { foreach ($table as &$tableName) { if (strpos($tableName, $prefix) === 0) { $tableName = str_replace($prefix, '', $tableName); } } } elseif (is_string($table)) { if (strpos($table, $prefix) === 0) { $table = str_replace($prefix, '', $table); } } else { throw new IcingaException('Table prefix handling for type "%s" is not supported', type($table)); } return $table; }