/** * Creates a new trip * * @return void */ public function create() { $tripName = Input::get('name'); if (empty($tripName) === true) { $tripName = 'Fun in the sun!'; } if (preg_match('/[^a-zA-Z\\d\\s-_!]/', $tripName) === 1) { $this->respond(array(), 400, 'Your trip name contains invalid characters.'); } if (strlen($tripName) > 255) { $this->respond(array(), 400, 'Your trip is too long, please limit it 250 characters.'); } $this->respond($this->_tripsRepo->create($tripName)); }