Created
April 13, 2011 18:52
-
-
Save padraic/918126 to your computer and use it in GitHub Desktop.
Package spec as a PHP 5.3 closure?
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
<?php | |
$package = function ($s) { | |
$s->name = 'Overlord'; | |
$s->authors = 'Padraic Brady, Sauron[[email protected]]'; | |
$s->version = '0.0.1-dev'; | |
$s->api_version = '0.0.1-dev'; | |
$s->summary = 'Monitoring library for Hobbit Detector 1.0'; | |
$s->description = file_get_contents(__DIR__ . '/description.txt'); | |
$s->homepage = 'http://en.wikipedia.org/wiki/Sauron'; | |
$s->changelog = file_get_contents(__DIR__ . '/changelog.txt'); | |
$s->files->php[] = 'library/**/*.php'; | |
$s->files->tests[] = 'tests/**/*.*'; | |
$s->files->reject[] = '*.project'; | |
$s->files->bin[] = 'scripts/overlord.bat'; | |
$s->include_path = 'MutateMe/Mutations/'; | |
$s->dependencies[] = 'PHP[>=5.3.1]'; | |
$s->dependencies[] = 'Pear[>=1.6.5]'; | |
$s->dependencies[] = 'MutateMe[0.5.0]'; | |
$s->dependencies[] = 'ext/runkit'; | |
$s->optional_dependencies[] = 'ext/eyeofsauron'; | |
$s->license = 'New BSD'; | |
}; |
No, not opposed to a stdClass. I'm rather trying to find out why it's necessary to have an "is-a" relationship by tagging $s
(still not sure of what's being passed in) with a function, instead of a more compressed "has-a" relationship like
$package = new stdClass;
$package->name = 'Overlord';
...
$s->package = $package;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As opposed to an instance of stdClass? I prefer the object oriented syntax - less quoting, and more readable. It's simply a personal preference. Something like Zend Framework could use it (theoretically). Just define a bunch of package files (.package is merely a suggested name). The glob style file patterns can sort out what to include or not. ZF is already heading off into generation for ZF 2.0 - based on phpdoc comments and namespace usage. Using a set of closures would, I think, be miles easier. This is merely an idea, of course ;).