Browse files

Moved autoloader to examples

  • Loading branch information...
1 parent a3cc928 commit ff01a317a4439c3fa6369b90c93a63b77db98ed6 @omnomicon omnomicon committed Jun 25, 2011
Showing with 38 additions and 35 deletions.
  1. +37 −0 examples/bootstrap.php
  2. +1 −1 examples/example1/example1.php
  3. +0 −34 library/Tracks.php
View
37 examples/bootstrap.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Examples
+ *
+ * PHP Version 5.3
+ *
+ * @category Tracks
+ * @package Examples
+ * @subpackage Autoloader
+ * @author Sean Crystal <sean.crystal@gmail.com>
+ * @copyright 2011 Sean Crystal
+ * @license http://www.opensource.org/licenses/BSD-3-Clause BSD 3-Clause
+ * @link https://github.com/spiralout/Tracks
+ */
+
+/**
+ * Tracks library autoloader
+ *
+ * @param string $className Class name
+ *
+ * @return null
+ */
+function tracksAutoloader($className)
+{
+ $file = dirname(__DIR__)
+ .DIRECTORY_SEPARATOR
+ .'library'
+ .DIRECTORY_SEPARATOR
+ .str_replace('\\', DIRECTORY_SEPARATOR, $className)
+ .'.php';
+
+ if (file_exists($file)) {
+ include $file;
+ }
+}
+
+spl_autoload_register('tracksAutoloader');
View
2 examples/example1/example1.php
@@ -13,7 +13,7 @@
* @link https://github.com/spiralout/Tracks
*/
-require_once '../../library/Tracks.php';
+require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap.php';
require_once 'Employer.php';
require_once 'Employee.php';
require_once 'Position.php';
View
34 library/Tracks.php
@@ -1,34 +0,0 @@
-<?php
-/**
- * Tracks CQRS Framework
- *
- * PHP Version 5.3
- *
- * @category Tracks
- * @package Tracks
- * @author Sean Crystal <sean.crystal@gmail.com>
- * @copyright 2011 Sean Crystal
- * @license http://www.opensource.org/licenses/BSD-3-Clause BSD 3-Clause
- * @link https://github.com/spiralout/Tracks
- */
-
-/**
- * Tracks library autoloader
- *
- * @param string $className Class name
- *
- * @return null
- */
-function tracksAutoloader($className)
-{
- $file = __DIR__
- .DIRECTORY_SEPARATOR
- .str_replace('\\', DIRECTORY_SEPARATOR, $className)
- .'.php';
-
- if (file_exists($file)) {
- include $file;
- }
-}
-
-spl_autoload_register('tracksAutoloader');

0 comments on commit ff01a31

Please sign in to comment.