-
-
Save nikic/7657d8b1eb6956b61674 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 Wrapper { | |
public $worker; | |
public function __construct() { | |
$this->worker = new Worker; | |
$this->worker->start(); | |
} | |
public function stack(Collectable $work) { | |
$this->worker->stack($work); | |
} | |
} | |
class Work extends Collectable { | |
public $wrapper; | |
public function __construct(Wrapper $wrapper) { | |
$this->wrapper = $wrapper; | |
} | |
public function stack() { | |
$this->wrapper->stack($this); | |
} | |
public function run() { | |
echo "Foo\n"; | |
} | |
} | |
$wrapper = new Wrapper; | |
$work = new Work($wrapper); | |
$work->stack(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment