Skip to content

Instantly share code, notes, and snippets.

@padraic
Created April 13, 2011 18:52
Show Gist options
  • Save padraic/918126 to your computer and use it in GitHub Desktop.
Save padraic/918126 to your computer and use it in GitHub Desktop.
Package spec as a PHP 5.3 closure?
<?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';
};
@chelmertz
Copy link

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