-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some cleanup (formatting/beautifying)
- Loading branch information
Showing
5 changed files
with
625 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,21 +2,21 @@ | |
/** | ||
* Example autoload implementation which uses the generated class map configuration | ||
* | ||
* This file contains the class definition and the registration of the autoloader | ||
* together for the sake of simplicity. This is up to you to separate the logic to | ||
* This file contains the class definition and the registration of the autoloader | ||
* together for the sake of simplicity. This is up to you to separate the logic to | ||
* your requirements/wishes. | ||
* | ||
* Usage: | ||
* <pre> | ||
* // include this file, e. g. at the beginning of your scripts or in a bootstrap | ||
* // include this file, e. g. at the beginning of your scripts or in a bootstrap | ||
* // implementation | ||
* require_once('/path/to/autoloader.php'); | ||
* // ... then use your classes ... | ||
* </pre> | ||
* | ||
* @category Development | ||
* @package mpAutoloaderClassMap | ||
* @author Murat Purc <[email protected]> | ||
* @package mpAutoloaderClassMap | ||
* @author Murat Purc <[email protected]> | ||
* @copyright Copyright (c) 2009-2011 Murat Purc (http://www.purc.de) | ||
* @license http://www.gnu.org/licenses/gpl-2.0.html - GNU General Public License, version 2 | ||
* @version $Id$ | ||
|
@@ -37,7 +37,7 @@ class myAutoloader | |
/** | ||
* Autoloader implementation | ||
* @param string $name The required class name | ||
* @throws Exception if autoloader couldn't set class map configuration in initial call | ||
* @throws Exception if autoloader couldn't set class map configuration in initial call | ||
*/ | ||
public static function autoload($name) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
<?php | ||
/** | ||
* Example usage for autoloader class map file generator. | ||
* | ||
* Parses full PEAR directory and creates a class map file! | ||
* | ||
* Usage: | ||
* ------ | ||
* 1. Modifiy settings to youre requriements | ||
* 2. call this cript from command line as follows: | ||
* $ php example.php | ||
* 3. Check created class map file | ||
* | ||
* @category Development | ||
* @package mpAutoloaderClassMap | ||
* @author Murat Purc <[email protected]> | ||
* @copyright Copyright (c) 2009-2011 Murat Purc (http://www.purc.de) | ||
* @license http://www.gnu.org/licenses/gpl-2.0.html - GNU General Public License, version 2 | ||
* @version $Id$ | ||
*/ | ||
|
||
|
||
################################################################################ | ||
##### Initialization/Settings | ||
|
||
// create a page context class, better than spamming global scope | ||
$context = new stdClass(); | ||
|
||
// current path | ||
$context->currentPath = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/'; | ||
|
||
// the destination file where the class map configuration should be written in | ||
$context->destinationFile = $context->currentPath . '/classmap.configuration.php'; | ||
|
||
// list of paths from where all class/interface names should be found | ||
// NOTE: Path depends on used environment and should be adapted | ||
$context->pathsToParse = array( | ||
'/path/to/my/project' | ||
); | ||
|
||
// list to collect class maps | ||
$context->classMapList = array(); | ||
|
||
// class file finder options | ||
$context->options = array( | ||
// exclude following folder names | ||
'excludeDirs' => array('temp', 'session', 'docs', 'tests'), | ||
// no specific file exclusion | ||
'excludeFiles' => array(), | ||
// parse all files with '.php' extension | ||
'extensionsToParse' => '.php', | ||
// disbale debugging | ||
'enableDebug' => false, | ||
); | ||
|
||
|
||
################################################################################ | ||
##### Process | ||
|
||
// include required classes | ||
include_once($context->currentPath . 'lib/mpClassTypeFinder.php'); | ||
include_once($context->currentPath . 'lib/mpClassMapFileCreator.php'); | ||
|
||
// collect all found class/interface names with their paths | ||
$context->classTypeFinder = new mpClassTypeFinder($context->options); | ||
foreach ($context->pathsToParse as $pos => $dir) { | ||
$classMap = $context->classTypeFinder->findInDir(new SplFileInfo($dir), true); | ||
if ($classMap) { | ||
$context->classMapList = array_merge($context->classMapList, $classMap); | ||
} | ||
} | ||
|
||
// uncomment following line to get some debug messages | ||
#echo $context->classTypeFinder->getFormattedDebugMessages(); | ||
|
||
|
||
// write the class map configuration | ||
$context->classMapCreator = new mpClassMapFileCreator(); | ||
$context->classMapCreator->create($context->classMapList, $context->destinationFile); | ||
|
||
|
||
// cleanup | ||
<?php | ||
/** | ||
* Example usage for autoloader class map file generator. | ||
* | ||
* Parses full PEAR directory and creates a class map file! | ||
* | ||
* Usage: | ||
* ------ | ||
* 1. Modifiy settings to youre requriements | ||
* 2. call this cript from command line as follows: | ||
* $ php example.php | ||
* 3. Check created class map file | ||
* | ||
* @category Development | ||
* @package mpAutoloaderClassMap | ||
* @author Murat Purc <[email protected]> | ||
* @copyright Copyright (c) 2009-2011 Murat Purc (http://www.purc.de) | ||
* @license http://www.gnu.org/licenses/gpl-2.0.html - GNU General Public License, version 2 | ||
* @version $Id$ | ||
*/ | ||
|
||
|
||
################################################################################ | ||
##### Initialization/Settings | ||
|
||
// create a page context class, better than spamming global scope | ||
$context = new stdClass(); | ||
|
||
// current path | ||
$context->currentPath = str_replace('\\', '/', realpath(dirname(__FILE__) . '/')) . '/'; | ||
|
||
// the destination file where the class map configuration should be written in | ||
$context->destinationFile = $context->currentPath . '/classmap.configuration.php'; | ||
|
||
// list of paths from where all class/interface names should be found | ||
// NOTE: Path depends on used environment and should be adapted | ||
$context->pathsToParse = array( | ||
'/path/to/my/project' | ||
); | ||
|
||
// list to collect class maps | ||
$context->classMapList = array(); | ||
|
||
// class file finder options | ||
$context->options = array( | ||
// exclude following folder names | ||
'excludeDirs' => array('temp', 'session', 'docs', 'tests'), | ||
// no specific file exclusion | ||
'excludeFiles' => array(), | ||
// parse all files with '.php' extension | ||
'extensionsToParse' => '.php', | ||
// disbale debugging | ||
'enableDebug' => false, | ||
); | ||
|
||
|
||
################################################################################ | ||
##### Process | ||
|
||
// include required classes | ||
include_once($context->currentPath . 'lib/mpClassTypeFinder.php'); | ||
include_once($context->currentPath . 'lib/mpClassMapFileCreator.php'); | ||
|
||
// collect all found class/interface names with their paths | ||
$context->classTypeFinder = new mpClassTypeFinder($context->options); | ||
foreach ($context->pathsToParse as $pos => $dir) { | ||
$classMap = $context->classTypeFinder->findInDir(new SplFileInfo($dir), true); | ||
if ($classMap) { | ||
$context->classMapList = array_merge($context->classMapList, $classMap); | ||
} | ||
} | ||
|
||
// uncomment following line to get some debug messages | ||
#echo $context->classTypeFinder->getFormattedDebugMessages(); | ||
|
||
|
||
// write the class map configuration | ||
$context->classMapCreator = new mpClassMapFileCreator(); | ||
$context->classMapCreator->create($context->classMapList, $context->destinationFile); | ||
|
||
|
||
// cleanup | ||
unset($context); |
Oops, something went wrong.