summaryrefslogtreecommitdiffstats
path: root/vendor/maxmind-db/reader/autoload.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-01-11 12:35:47 +0100
commit19985dbb8c0aa66dc4bf7905abc1148de909097d (patch)
tree2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /vendor/maxmind-db/reader/autoload.php
download1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst
1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip
Diffstat (limited to 'vendor/maxmind-db/reader/autoload.php')
-rw-r--r--vendor/maxmind-db/reader/autoload.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/vendor/maxmind-db/reader/autoload.php b/vendor/maxmind-db/reader/autoload.php
new file mode 100644
index 0000000..c79126f
--- /dev/null
+++ b/vendor/maxmind-db/reader/autoload.php
@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * PSR-4 autoloader implementation for the MaxMind\DB namespace.
+ * First we define the 'mmdb_autoload' function, and then we register
+ * it with 'spl_autoload_register' so that PHP knows to use it.
+ *
+ * @param mixed $class
+ */
+
+/**
+ * Automatically include the file that defines <code>class</code>.
+ *
+ * @param string $class
+ * the name of the class to load
+ */
+function mmdb_autoload($class)
+{
+ /*
+ * A project-specific mapping between the namespaces and where
+ * they're located. By convention, we include the trailing
+ * slashes. The one-element array here simply makes things easy
+ * to extend in the future if (for example) the test classes
+ * begin to use one another.
+ */
+ $namespace_map = ['MaxMind\\Db\\' => __DIR__ . '/src/MaxMind/Db/'];
+
+ foreach ($namespace_map as $prefix => $dir) {
+ /* First swap out the namespace prefix with a directory... */
+ $path = str_replace($prefix, $dir, $class);
+
+ /* replace the namespace separator with a directory separator... */
+ $path = str_replace('\\', '/', $path);
+
+ /* and finally, add the PHP file extension to the result. */
+ $path = $path . '.php';
+
+ /* $path should now contain the path to a PHP file defining $class */
+ if (file_exists($path)) {
+ include $path;
+ }
+ }
+}
+
+spl_autoload_register('mmdb_autoload');