<commit_before><?php
/**
 * Handles collecting the users details and creating a registration to an event
 * for them.
 *
 * @package silverstripe-eventmanagement
 */
class EventRegisterController extends Page_Controller {

	public static $url_handlers = array(
		'' => 'index'
	);

	public static $allowed_actions = array(
		'index',
		'RegisterForm',
		'afterregistration',
		'confirm'
	);

	protected $parent;
	protected $time;

	/**
	 * Constructs a new controller for creating a registration.
	 *
	 * @param Controller $parent
	 * @param RegisterableDateTiem $time
	 */
	public function __construct($parent, $time) {
		$this->parent = $parent;
		$this->time   = $time;

		parent::__construct();
	}

	public function init() {
		parent::init();

		if (!$this->time->canRegister()) {
			return Security::permissionFailure($this, array(
				'default' => 'You do not have permission to register for this event'
			));
		}
	}

	/**
	 * @return string
	 */
	public function index() {
		$event = $this->time->Event();

		if ($event->LimitedPlaces && ($this->time->getRemainingPlaces() < 1)) {
			$message = _t('EventManagement.NOPLACES', 'This event has no more places available.');

			return array(
				'Title'   => _t('EventManagement.EVENTISFULL', 'This Event Is Full'),
				'Content' => "<p>$message</p>"
			);
		}

		$title = sprintf(
			_t('EventManagement.REGISTERFOR', 'Register For %s'), $this->time->EventTitle()
		);

		$controller = $this->customise(array(
			'Title' => $title,
			'Form'  => $this->RegisterForm()
		));<commit_msg>Fixed an error with an action expecting a string rather than an array.<commit_after><?php
/**
 * Handles collecting the users details and creating a registration to an event
 * for them.
 *
 * @package silverstripe-eventmanagement
 */
class EventRegisterController extends Page_Controller {

	public static $url_handlers = array(
		'' => 'index'
	);

	public static $allowed_actions = array(
		'index',
		'RegisterForm',
		'afterregistration',
		'confirm'
	);

	protected $parent;
	protected $time;

	/**
	 * Constructs a new controller for creating a registration.
	 *
	 * @param Controller $parent
	 * @param RegisterableDateTiem $time
	 */
	public function __construct($parent, $time) {
		$this->parent = $parent;
		$this->time   = $time;

		parent::__construct();
	}

	public function init() {
		parent::init();

		if (!$this->time->canRegister()) {
			return Security::permissionFailure($this, array(
				'default' => 'You do not have permission to register for this event'
			));
		}
	}

	/**
	 * @return string
	 */
	public function index() {
		$event = $this->time->Event();
		if ($event->LimitedPlaces && ($this->time->getRemainingPlaces() < 1)) {
			$message = _t('EventManagement.NOPLACES', 'This event has no more places available.');

			$controller = $this->customise(array(
				'Title'   => _t('EventManagement.EVENTISFULL', 'This Event Is Full'),
				'Content' => "<p>$message</p>"
			));
			return $this->getViewer('index')->process($controller);
		}

		$title = sprintf(
			_t('EventManagement.REGISTERFOR', 'Register For %s'), $this->time->EventTitle()
		);

		$controller = $this->customise(array(
			'Title' => $title,
			'Form'  => $this->RegisterForm()
		));
{'fraction_non_alphanumeric': 0.1610800744878957, 'fraction_numerical': 0.0006207324643078833, 'mean_word_length': 3.8833333333333333, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 48, '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': '6636677', 'n_tokens_mistral': 1110, 'n_tokens_neox': 990, 'n_words': 262}