Last active
August 29, 2015 14:07
-
-
Save tobiasgies/df5ef2ef658401cc634d to your computer and use it in GitHub Desktop.
Invoke class property test
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 Invokeable { | |
public function __invoke() { | |
echo "Hello World!\r\n"; | |
} | |
} | |
class Container { | |
private $_invokeable; | |
public function __construct(Invokeable $invokeable) { | |
$this->_invokeable = $invokeable; | |
} | |
public function callIt() { | |
$this->_invokeable(); | |
} | |
} | |
$invokeable = new Invokeable(); | |
$invokeable(); | |
$container = new Container($invokeable); | |
$container->callIt(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result of running this file: