Skip to content

Instantly share code, notes, and snippets.

@pix-art pix-art/CourseService.php Secret
Last active Apr 14, 2016

Embed
What would you like to do?
How to write a complex function
<?php
class CourseService {
...
public function signUp(SmartCode $code, User $user)
{
$this->guardThatSmartCodeIsValid($code);
$course = $code->getPayload();
$this->guardThatUserIsNotSignedUp($user, $course);
$this->smartCodeService->register($user, $code);
$enrollment = $this->smartCodeEnrollment->enroll($user, $course);
return $enrollment;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.