_eventType = $eventType; $this->_typeRules = self::getRules($eventType); } public function __get($name) { if (array_key_exists($name, $this->_typeRules)) { return $this->_typeRules[$name]; } throw new \Exception('Unknown feature name "' . $name . '"'); } public function __isset($name) { return array_key_exists($name, $this->_typeRules); } public function __set($name, $value) { throw new \Exception('Error writing read only property "' . $name . '"'); } public function __unset($name) { throw new \Exception('Error writing read only property "' . $name . '"'); } protected static function getRules($eventType) { $rules = [ Entity::TYPE_WORKSHOP => [ self::FEATURE_REGISTER => true, self::FEATURE_REGISTER_MEMBER => true, self::FEATURE_REGISTER_NONMEMBER => true, self::FEATURE_DURATION_MULTI => true, self::FEATURE_LOCATION => true, self::FEATURE_ADD_OUTLOOK => true, self::FEATURE_EB_PRICING => true, self::FEATURE_CEU => true, self::FEATURE_PRODUCTS => true, self::FEATURE_OPTIONS => true, self::FEATURE_SPOUSE => false, self::FEATURE_ADD_TAX_EVENT => false, self::FEATURE_TRADE_SHOWS => true, self::FEATURE_REPORT_FULL => true, self::FEATURE_REPORT_REG_LIST => true, self::FEATURE_REPORT_SIGN_IN_SHEET => true, ], Entity::TYPE_CONFERENCE => [ self::FEATURE_REGISTER => true, self::FEATURE_REGISTER_MEMBER => true, self::FEATURE_REGISTER_NONMEMBER => false, self::FEATURE_DURATION_MULTI => true, self::FEATURE_LOCATION => true, self::FEATURE_ADD_OUTLOOK => true, self::FEATURE_EB_PRICING => true, self::FEATURE_CEU => false, self::FEATURE_PRODUCTS => false, self::FEATURE_OPTIONS => true, self::FEATURE_SPOUSE => true, self::FEATURE_ADD_TAX_EVENT => false, self::FEATURE_TRADE_SHOWS => true, self::FEATURE_REPORT_FULL => true, self::FEATURE_REPORT_REG_LIST => true, self::FEATURE_REPORT_SIGN_IN_SHEET => true, ], Entity::TYPE_WEBINAR => [ self::FEATURE_REGISTER => true, self::FEATURE_REGISTER_MEMBER => true, self::FEATURE_REGISTER_NONMEMBER => true, self::FEATURE_DURATION_MULTI => false, self::FEATURE_LOCATION => false, self::FEATURE_ADD_OUTLOOK => true, self::FEATURE_EB_PRICING => false, self::FEATURE_CEU => false, self::FEATURE_PRODUCTS => false, self::FEATURE_OPTIONS => false, self::FEATURE_SPOUSE => false, self::FEATURE_ADD_TAX_EVENT => false, self::FEATURE_TRADE_SHOWS => false, self::FEATURE_REPORT_FULL => true, self::FEATURE_REPORT_REG_LIST => false, self::FEATURE_REPORT_SIGN_IN_SHEET => false, ], ]; if (!array_key_exists($eventType, $rules)) { throw new \Exception('Unknown event type "' . $eventType . '"'); } return $rules[$eventType]; } }