Created
October 7, 2015 13:02
-
-
Save tacoberu/6de6568728081f6a360f to your computer and use it in GitHub Desktop.
Jak přidat do existující třídy novou funkcionalitu. Anemicky.
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 Int | |
{ | |
function __construct($value){} | |
function getValue(){} | |
} | |
class IntPlusOp | |
{ | |
function invoke(Int $m){} | |
} | |
class IntMinusOp | |
{ | |
function invoke(Int $m){} | |
} | |
class IntIncOp | |
{ | |
function invoke(Int $m){} | |
} | |
$a = new Int(1); | |
$b = new Int(2); | |
$c = new Int(3); | |
(new IntIncOp())->invoke($a); | |
(new IntIncOp())->invoke($b); | |
(new IntIncOp())->invoke($c); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment