Skip to content

Instantly share code, notes, and snippets.

@anderskitson
Created September 26, 2016 15:59
Show Gist options
  • Save anderskitson/c4c130ee31edaadc47d00d72e14869aa to your computer and use it in GitHub Desktop.
Save anderskitson/c4c130ee31edaadc47d00d72e14869aa to your computer and use it in GitHub Desktop.
<?php namespace Acme;
class AuthController{
protected $registration;
public function __construct(RegisterUser $registration){
$this->registration = $registration;
}
public function register(){
$this->registration->execute([],$this);
}
public function userRegisteredSuccessfully(){
var_dump('Created Successfully. Redirect Somewhere');
}
public function userRegisteredFailed(){
var_dump('Created Failed. Redirect Back');
}
}
<?php
$registration = new Acme\RegisterUser;
$authController = new Acme\AuthController($registration);
$authController->register();
<?php namespace Acme;
class RegisterUser{
public function execute(array $data, $listener){
var_dump('Registering the user.');
$listener->userRegisteredSuccessfully();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment