summaryrefslogtreecommitdiffstats
path: root/php-hoa-event-autoload.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-04-04 16:37:52 +0200
committerRemi Collet <fedora@famillecollet.com>2016-04-04 16:37:52 +0200
commit1ada833f2d727d68b83c22878a37842c6de3998a (patch)
tree3e1a9dc64053bee9c7e9fb36889212f0fd97ca5d /php-hoa-event-autoload.php
php-hoa-event: new package (wip)
Diffstat (limited to 'php-hoa-event-autoload.php')
-rw-r--r--php-hoa-event-autoload.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/php-hoa-event-autoload.php b/php-hoa-event-autoload.php
new file mode 100644
index 0000000..02ad1f9
--- /dev/null
+++ b/php-hoa-event-autoload.php
@@ -0,0 +1,24 @@
+<?php
+/* Autoloader for hoa/event and its dependencies */
+
+$vendor = '/usr/share/php';
+// Use Symfony autoloader
+if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendor . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
+
+$fedoraClassLoader->addPrefix('Hoa\\Event\\', dirname(dirname(__DIR__)));
+
+// Dependencies
+foreach ([
+ $vendor . '/Hoa/Consistency/autoload.php' => true,
+ $vendor . '/Hoa/Exception/autoload.php' => true,
+ ] as $dep => $mandatory) {
+ if ($mandory || file_exists($dep) require_once($dep);
+}
+