Created
May 19, 2015 17:58
-
-
Save MacDada/226d7bde0a585cfb8b27 to your computer and use it in GitHub Desktop.
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 | |
class MyCode | |
{ | |
private function option1() | |
{ | |
$this->notMyCode->doSomething(function ($value) { | |
return strlen($value); | |
}); | |
} | |
private function option2() | |
{ | |
$this->notMyCode->doSomething('strlen'); | |
} | |
} |
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 | |
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