Skip to content

Instantly share code, notes, and snippets.

@MacDada
Created May 19, 2015 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MacDada/226d7bde0a585cfb8b27 to your computer and use it in GitHub Desktop.
Save MacDada/226d7bde0a585cfb8b27 to your computer and use it in GitHub Desktop.
<?php
class MyCode
{
private function option1()
{
$this->notMyCode->doSomething(function ($value) {
return strlen($value);
});
}
private function option2()
{
$this->notMyCode->doSomething('strlen');
}
}
<?php
class NotMyCode
{
public function doSomething(\Closure $callback)
{
// Nie mój kod, ale chcę z niego skorzystać, wymaga \Closure
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment