diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ecdf2d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +vendor +.idea diff --git a/src/Database/Connection.php b/src/Database/Connection.php index 790783f..fbd5bff 100644 --- a/src/Database/Connection.php +++ b/src/Database/Connection.php @@ -37,6 +37,12 @@ protected function run($query, $bindings, \Closure $callback) ); } + /** + * Append SQL comments to the underlying query. + * + * @param string $query + * @return string + */ private function appendSqlComments(string $query): string { static $configurationKey = 'google_sqlcommenter.include'; @@ -52,7 +58,7 @@ private function appendSqlComments(string $query): string if (config("{$configurationKey}.controller", true) && !empty($action['controller'])) { $comments['controller'] = explode("@", class_basename($action['controller']))[0]; } - if (config("{$configurationKey}.action", true) && !empty($action and $action['controller'] && str_contains($action['controller'], '@'))) { + if (config("{$configurationKey}.action", true) && !empty($action) && !empty($action['controller']) && str_contains($action['controller'], '@')) { $comments['action'] = explode("@", class_basename($action['controller']))[1]; } if (config("{$configurationKey}.route", true)) { diff --git a/src/Opentelemetry.php b/src/Opentelemetry.php index b793c48..d49da14 100644 --- a/src/Opentelemetry.php +++ b/src/Opentelemetry.php @@ -21,6 +21,11 @@ class Opentelemetry { + /** + * Get the underlying Opentelemetry values. + * + * @return array + */ public static function getOpentelemetryValues() { $carrier = []; diff --git a/src/Utils.php b/src/Utils.php index 387835a..900d1ff 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -19,6 +19,12 @@ class Utils { + /** + * Format query comments. + * + * @param array $comments + * @return string + */ public static function formatComments(array $comments): string { if (empty($comments)) { @@ -34,6 +40,12 @@ public static function formatComments(array $comments): string ) . "*/"; } + /** + * Encode URL. + * + * @param string $input + * @return string + */ private static function customUrlEncode(string $input): string { $encodedString = urlencode($input);