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 EntityObject { | |
private $arData = array(); | |
public function __construct ($initialValue) { | |
$this->setProperty($initialValue); | |
} | |
public function setProperty ($value) { |
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
[ | |
{ | |
"reservation_id" : "R1", | |
"client_id" : "robert-id", | |
"date" : "2017-10-10", | |
"time" : "9:00pm", | |
"number_of_guests" : 10 | |
}, | |
{ | |
"reservation_id" : "R2", |
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
{ | |
"client_id": "my-id", | |
"date": "2017-12-12", | |
"time": "9:30pm", | |
"number_of_guests": 12 | |
} |
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
[ | |
{ | |
"reservation_id" : "R1", | |
"client_id" : "robert-id", | |
"date" : "2017-10-10", | |
"time" : "9:00pm", | |
"number_of_guests" : 10 | |
}, | |
{ | |
"reservation_id" : "R2", |
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
{ | |
"reservation_id": "R3", | |
"client_id": "my-id", | |
"date": "2017–12–12", | |
"time": "9:30pm", | |
"number_of_guests": 12 | |
} |
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
{ | |
"client_id": "my-id", | |
"date": "2018–12–12", | |
"time": "9:00pm", | |
"number_of_guests": 2 | |
} |
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
{ | |
"time": "9:30pm" | |
} |
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
interface FileParser |
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 XmlFileParser : FileParser | |
class JsonFileParser : FileParser |
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
/* The concept of the factory -> creates a Product */ | |
interface FileParserFactory { | |
fun createFromFileName(fileName: String): FileParser | |
} | |
/* Our specific Factory */ | |
class StandardFileParserFactory : FileParserFactory { | |
override fun createFromFileName(fileName: String) = | |
when (fileName.substringAfterLast('.')) { | |
"xml" -> XmlFileParser() |
OlderNewer