Created
October 25, 2013 13:55
-
-
Save cebe/7155082 to your computer and use it in GitHub Desktop.
trait event handling thinking...
This file contains hidden or 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 | |
trait BehaviorA | |
{ | |
public function handleExampleEvent() | |
{ | |
// do something | |
} | |
} |
This file contains hidden or 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 | |
trait BehaviorA | |
{ | |
public function handleExampleEvent() | |
{ | |
// do something | |
} | |
public function handleAnotherEvent() | |
{ | |
// do something | |
} | |
} |
This file contains hidden or 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 MyComponent extends Component | |
{ | |
use BehaviorA, BehaviorB { | |
BehaviorA::handleExampleEvent as handleExampleEvent1; | |
BehaviorB::handleExampleEvent as handleExampleEvent2; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment