/**
  * Checks if the option value has the right type
  *
  * @param string  $optionName The name of the option to validate
  * @param unknown $candidate  The value of the option to validate
  *
  * @return void
  */
 private static function _checkType($optionName, $candidate, org_tubepress_api_message_MessageService $messageService)
 {
     $type = org_tubepress_impl_options_OptionsReference::getType($optionName);
     switch ($type) {
         case org_tubepress_api_const_options_Type::TEXT:
         case org_tubepress_api_const_options_Type::YT_USER:
         case org_tubepress_api_const_options_Type::PLAYLIST:
             if (!is_string($candidate)) {
                 throw new Exception(sprintf($messageService->_('validation-text'), $optionName, $candidate));
             }
             break;
         case org_tubepress_api_const_options_Type::BOOL:
             if (strcasecmp((string) $candidate, '1') !== 0 && strcasecmp((string) $candidate, '') !== 0) {
                 throw new Exception(sprintf($messageService->_('validation-bool'), $optionName, $candidate));
             }
             break;
         case org_tubepress_api_const_options_Type::INTEGRAL:
             if (intval($candidate) == 0 && $optionName != org_tubepress_api_const_options_names_Display::DESC_LIMIT && $optionName !== org_tubepress_api_const_options_names_Feed::RESULT_COUNT_CAP) {
                 throw new Exception(sprintf($messageService->_('validation-int-type'), $optionName, $candidate));
             }
             break;
         case org_tubepress_api_const_options_Type::ORDER:
         case org_tubepress_api_const_options_Type::PLAYER:
         case org_tubepress_api_const_options_Type::PLAYER_IMPL:
         case org_tubepress_api_const_options_Type::SAFE_SEARCH:
         case org_tubepress_api_const_options_Type::TIME_FRAME:
             $validValues = org_tubepress_impl_options_OptionsReference::getValidEnumValues($type);
             if (in_array((string) $candidate, $validValues) !== true) {
                 throw new Exception(sprintf($messageService->_('validation-enum'), $optionName, implode(', ', $validValues), $candidate));
             }
             break;
         case org_tubepress_api_const_options_Type::COLOR:
             //implement me please
             break;
     }
 }