Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created May 2, 2014 10:13
Show Gist options
  • Save rightfold/5245df9cb5f5eb726215 to your computer and use it in GitHub Desktop.
Save rightfold/5245df9cb5f5eb726215 to your computer and use it in GitHub Desktop.
<?php
function compose($f, $g) {
return function() use($f, $g) {
return $f(call_user_func_array($g, func_get_args()));
};
}
function ctor($class) {
$reflect = new \ReflectionClass($class);
return function() use($reflect) {
return $reflect->newInstanceArgs(func_get_args());
};
}
$scopeParentID = mapNullable($request->query->get('scope-parent'),
compose(ctor('NodeID'), 'intval'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment