Created
September 1, 2016 12:47
-
-
Save seutje/975188a3da8558d3d14d7ff0c9487308 to your computer and use it in GitHub Desktop.
conditional extension
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 Bar extends DsFieldBase { | |
public function __construct($foo) { | |
// do some other stuff... | |
} | |
} |
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 Foo extends DsFieldBase { | |
public function __construct($foo) { | |
// do some stuff... | |
} | |
} |
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 Foo extends DsFieldBase { | |
public function __construct($foo) { | |
if ($condition) { | |
return new Foo($foo); | |
} | |
else { | |
return new Bar($foo); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment