PHP8
[m6w6/seekat] / lib / functions.php
index fdd9ea0a02bf16a0079b8782c065f3b53063390d..9130fd40b53074d1cc46cf97605acde67e4a6b65 100644 (file)
@@ -1,21 +1,28 @@
 <?php
 
-namespace seekat;
-
-/**
- * Generate a human readable represenation of a variable
- * @param mixed $arg
- * @param bool $export whether to var_export the $arg
- * @return string
- */
-function typeof($arg, $export = false) {
-       $type = (is_object($arg)
-               ? "instance of ".get_class($arg)
-               : gettype($arg)
-       );
-       if ($export) {
-               $type .= ": ".var_export($arg, true);
+namespace {
+       if (!function_exists("uri_template")) {
+               function uri_template(string $str, array $arr = []) : string {
+                       $tpl = new \Rize\UriTemplate;
+                       return $tpl->expand($str, $arr);
+               }
        }
-       return $type;
 }
 
+namespace seekat {
+       /**
+        * Generate a human readable representation of a variable
+        * @param mixed $arg
+        * @param bool $export whether to var_export the $arg
+        * @return string
+        */
+       function typeof($arg, $export = false) {
+               $type = is_object($arg)
+                       ? "instance of ".get_class($arg)
+                       : gettype($arg);
+               if ($export) {
+                       $type .= ": ".var_export($arg, true);
+               }
+               return $type;
+       }
+}