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
<? | |
$triangle = | |
new Polygon([new Point(1, 1), new Point(2, 2), new Point(3, 3)]); | |
$lastPoint = $triangle->getVertices()->last(); | |
foreach ($triangle->getVertices() as $vertex) { | |
$canvas->drawLine($vertex, $lastPoint); | |
$lastPoint = $vertex; | |
} |
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
<? | |
$triangle = new | |
Polygon([(new Point(1,1), new Point(2,2), new Point(3,3))]); | |
array_shift($triangle->getVertices()); |
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
<? | |
function iterator(): Iterator { | |
return new ArrayIterator($this->vertices); | |
} |
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
<? | |
function verticesDo($function) { | |
foreach ($this->vertices as $vertex) { | |
$$function($vertex); | |
} | |
} |
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
<? | |
final class TwitterAccount { | |
private $followers; | |
private function __construct() { | |
$this->followers = []; | |
} | |
} |
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
<? | |
$mcsee1 = new TwitterAccount('mcsee1'); | |
$pontifex = new TwitterAccount('pontifex'); | |
$mcsee1->getFollowers()[] = $pontifex; |
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
<? | |
$mcsee1 = new TwitterAccount('mcsee1'); | |
$pontifex = new TwitterAccount('pontifex'); | |
$mcsee1->addFollower($pontifex); |
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
<? | |
StrategySupervisedHelper::getInstance()->optimize($processId); |
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
<? | |
StrategySupervisedHelper::getInstance()->optimize($processId); |
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
<? | |
class StrategySupervisedHelper extends Singleton { | |
// ... | |
} |