public function __construct($id = '') { $this->id = new Id(); $this->projectsProperties = new MapOf(function () { return new ProjectProperties(); }); $this->projectUserProfiles = new MapOf(function () { return new SfchecksUserProfile(); }); parent::__construct($id); }
public function __construct($id = '') { $this->fruitsMap = new MapOf(function ($data) { if (array_key_exists('numOfSlices', $data)) { return new Apple(); } elseif (array_key_exists('peelThickness', $data)) { return new Orange(); } else { return new Fruit(); } }); $this->fruitsArray = new ArrayOf(function ($data) { if (array_key_exists('numOfSlices', $data)) { return new Apple(); } elseif (array_key_exists('peelThickness', $data)) { return new Orange(); } else { return new Fruit(); } }); parent::__construct($id); }