Last active
August 29, 2015 14:23
-
-
Save anyt/4d622b316387bc436ce6 to your computer and use it in GitHub Desktop.
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 A { | |
protected $kernel; | |
public function handle() { | |
print 1; | |
} | |
public function __construct() { | |
} | |
} | |
class B { | |
protected $kernel; | |
public function handle() { | |
$this->kernel->handle(); | |
// some extra logic; | |
print 2; | |
} | |
public function __construct($kernel) { | |
$this->kernel = $kernel; | |
} | |
} | |
class C { | |
protected $kernel; | |
public function handle() { | |
$this->kernel->handle(); | |
// some extra logic; | |
print 3; | |
} | |
public function __construct($kernel) { | |
$this->kernel = $kernel; | |
} | |
} | |
$a = new A(); | |
$a = new B($a); | |
$a = new C($a); | |
$a->handle(); // will print 123; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment