Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring. Moving all recess\core to recess\lang.
- Loading branch information
1 parent
fff5143
commit f95e978
Showing
11 changed files
with
65 additions
and
41 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 |
---|---|---|
@@ -1,8 +1,46 @@ | ||
<?php | ||
set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path()); | ||
|
||
function callable($callback) { | ||
if(!is_callable($callback)) { | ||
throw new Exception('First parameter $callable must be a valid is_callable value.'); | ||
} | ||
|
||
if(!is_array($callback)) { | ||
return $callback; | ||
} | ||
|
||
if(is_string($callback[0])) { | ||
return function() use ($callback) { | ||
$args = func_get_args(); | ||
switch(count($args)) { | ||
case 0: return $callback[0]::$callback[1](); | ||
case 1: return $callback[0]::$callback[1]($args[0]); | ||
case 2: return $callback[0]::$callback[1]($args[0],$args[1]); | ||
case 3: return $callback[0]::$callback[1]($args[0],$args[1],$args[2]); | ||
case 4: return $callback[0]::$callback[1]($args[0],$args[1],$args[2],$args[3]); | ||
case 5: return $callback[0]::$callback[1]($args[0],$args[1],$args[2],$args[3],$args[4]); | ||
default: return call_user_func_array($callback,$args); | ||
} | ||
}; | ||
} else { | ||
return function() use ($callback) { | ||
$args = func_get_args(); | ||
switch(count($args)) { | ||
case 0: return $callback[0]->$callback[1](); | ||
case 1: return $callback[0]->$callback[1]($args[0]); | ||
case 2: return $callback[0]->$callback[1]($args[0],$args[1]); | ||
case 3: return $callback[0]->$callback[1]($args[0],$args[1],$args[2]); | ||
case 4: return $callback[0]->$callback[1]($args[0],$args[1],$args[2],$args[3]); | ||
case 5: return $callback[0]->$callback[1]($args[0],$args[1],$args[2],$args[3],$args[4]); | ||
default: return call_user_func_array($callback,$args); | ||
} | ||
}; | ||
} | ||
} | ||
|
||
// Include the Autoloader | ||
include 'recess/core/ClassLoader.class.php'; | ||
include 'recess/lang/ClassLoader.class.php'; | ||
|
||
// Register Autoload Function | ||
spl_autoload_register('recess\core\ClassLoader::load'); | ||
spl_autoload_register('recess\lang\ClassLoader::load'); |
2 changes: 1 addition & 1 deletion
2
recess/recess/core/Candy.class.php → recess/recess/lang/Candy.class.php
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
2 changes: 1 addition & 1 deletion
2
recess/recess/core/ClassLoader.class.php → recess/recess/lang/ClassLoader.class.php
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
2 changes: 1 addition & 1 deletion
2
recess/recess/core/Event.class.php → recess/recess/lang/Event.class.php
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
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
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
recess/test/recess/core/CandyTest.php → recess/test/recess/lang/CandyTest.php
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
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
2 changes: 1 addition & 1 deletion
2
recess/test/recess/core/Dummy.class.php → recess/test/recess/lang/Dummy.class.php
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
4 changes: 2 additions & 2 deletions
4
recess/test/recess/core/EventTest.php → recess/test/recess/lang/EventTest.php
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
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