<commit_before><?php

class Denkmal_FormAction_EventAdd_Create extends CM_FormAction_Abstract {

	protected function _getRequiredFields() {
		return array('venue', 'date', 'fromTime', 'title');
	}

	protected function _checkData(CM_Params $params, CM_Response_View_Form $response, CM_Form_Abstract $form) {
		$name = $params->get('venue');
		if (!$name instanceof Denkmal_Model_Venue) {
			if ($venue = Denkmal_Model_Venue::findByNameOrAlias($name)) {
				$response->addError('Name already used by venue `' . $venue->getName() . '`', 'venue');
			}
		}
	}

	protected function _process(CM_Params $params, CM_Response_View_Form $response, CM_Form_Abstract $form) {
		/** @var Denkmal_Params $params */
		$venue = $params->get('venue');
		if (!$venue instanceof Denkmal_Model_Venue) {
			$name = (string) $venue;
			$address = $params->has('venueAddress') ? $params->getString('venueAddress') : null;
			$url = $params->has('venueUrl') ? $params->getString('venueUrl') : null;

			$venue = new Denkmal_Model_Venue();
			$venue->create($name, true, false, false, $url, $address);
		}

		$date = $params->getDateTime('date');
		$from = clone $date;
		$from->add($params->getDateInterval('fromTime'));
		$until = null;
		if ($params->has('untilTime')) {
			$until = clone $date;
			$until->add($params->getDateInterval('untilTime'));
			if ($until < $from) {
				$until->add(new DateInterval('P1D'));
			}
		}

		$title = $params->getString('title');
		$descriptionParts = array();
		$descriptionParts[] = $params->getString('artists', '');
		$descriptionParts[] = $params->getString('genres', '');
		$descriptionParts[] = $params->getString('urls', '');
		$descriptionParts = array_filter($descriptionParts, 'trim');
		$description = implode(' ', $descriptionParts);

		if (empty($description)) {
			$description = $title;
			$title = null;
		}
		Denkmal_Model_Event::create($venue, $description, false, true, $from, $until, $title);
	}
}
<commit_msg>Fix model::create() usage<commit_after><?php

class Denkmal_FormAction_EventAdd_Create extends CM_FormAction_Abstract {

	protected function _getRequiredFields() {
		return array('venue', 'date', 'fromTime', 'title');
	}

	protected function _checkData(CM_Params $params, CM_Response_View_Form $response, CM_Form_Abstract $form) {
		$name = $params->get('venue');
		if (!$name instanceof Denkmal_Model_Venue) {
			if ($venue = Denkmal_Model_Venue::findByNameOrAlias($name)) {
				$response->addError('Name already used by venue `' . $venue->getName() . '`', 'venue');
			}
		}
	}

	protected function _process(CM_Params $params, CM_Response_View_Form $response, CM_Form_Abstract $form) {
		/** @var Denkmal_Params $params */
		$venue = $params->get('venue');
		if (!$venue instanceof Denkmal_Model_Venue) {
			$name = (string) $venue;
			$address = $params->has('venueAddress') ? $params->getString('venueAddress') : null;
			$url = $params->has('venueUrl') ? $params->getString('venueUrl') : null;

			$venue = Denkmal_Model_Venue::create($name, true, false, false, $url, $address);
		}

		$date = $params->getDateTime('date');
		$from = clone $date;
		$from->add($params->getDateInterval('fromTime'));
		$until = null;
		if ($params->has('untilTime')) {
			$until = clone $date;
			$until->add($params->getDateInterval('untilTime'));
			if ($until < $from) {
				$until->add(new DateInterval('P1D'));
			}
		}

		$title = $params->getString('title');
		$descriptionParts = array();
		$descriptionParts[] = $params->getString('artists', '');
		$descriptionParts[] = $params->getString('genres', '');
		$descriptionParts[] = $params->getString('urls', '');
		$descriptionParts = array_filter($descriptionParts, 'trim');
		$description = implode(' ', $descriptionParts);

		if (empty($description)) {
			$description = $title;
			$title = null;
		}
		Denkmal_Model_Event::create($venue, $description, false, true, $from, $until, $title);
	}
}

{'fraction_non_alphanumeric': 0.18565183851889946, 'fraction_numerical': 0.0005142710208279763, 'mean_word_length': 5.304700162074554, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2368578', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1269, 'n_words': 244}