-
-
Save pix-art/9d466fe7a25ac1e32d19e031fc32e054 to your computer and use it in GitHub Desktop.
How to write a complex function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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