-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring repos, moving in traits, adding isVerified to Person
- Loading branch information
1 parent
2a8c6b0
commit 1f94a7a
Showing
11 changed files
with
163 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
|
||
namespace App\VisageFour\Bundle\ToolsBundle\Exceptions; | ||
|
||
|
||
class PersonNotFound extends \Exception | ||
{ | ||
public function __construct($email) | ||
{ | ||
parent::__construct(); | ||
|
||
$this->message = | ||
'Person with email address: '. $email .' was not found.' | ||
; | ||
} | ||
} |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/* | ||
* created on: 03/06/2020 at 4:47 PM | ||
* by: cameronrobertburns | ||
*/ | ||
|
||
namespace VisageFour\Bundle\ToolsBundle\Traits; | ||
|
||
use Psr\Log\LoggerInterface; | ||
|
||
trait LoggerTrait | ||
{ | ||
/** | ||
* @var LoggerInterface|null | ||
*/ | ||
protected $logger; | ||
|
||
/** | ||
* @required | ||
* note: required is what tells symfony to call this and inject $logger | ||
*/ | ||
public function setLogger(LoggerInterface $logger) | ||
{ | ||
$this->logger = $logger; | ||
} | ||
|
||
private function logInfo(string $message, array $context = []) | ||
{ | ||
$this->checkLoggerIsSet(); | ||
$this->logger->info($message, $context); | ||
} | ||
|
||
private function checkLoggerIsSet () { | ||
if (empty($this->logger)) { | ||
throw new \Exception ("LoggerTrait dependency: 'Logger' has not been set. Please set it prior to using the: ". __CLASS__ ." class." ); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/* | ||
* created on: 30/06/2020 at 10:53 PM | ||
* by: cameronrobertburns | ||
*/ | ||
|
||
namespace VisageFour\Bundle\ToolsBundle\Traits; | ||
|
||
use Symfony\Component\Routing\Router; | ||
|
||
trait RouterTrait | ||
{ | ||
/** | ||
* @var Router|null | ||
*/ | ||
private $router; | ||
|
||
/** | ||
* @required | ||
*/ | ||
public function setRouter(Router $router) | ||
{ | ||
$this->router = $router; | ||
} | ||
|
||
protected function getRouter() : Router | ||
{ | ||
$this->checkRouterIsSet(); | ||
return $this->router; | ||
} | ||
|
||
private function checkRouterIsSet () { | ||
if (empty($this->router)) { | ||
throw new \Exception ("RouterTrait dependency: 'Router' has not been set. Please set it prior to using the: ". __CLASS__ ." class." ); | ||
} | ||
} | ||
} |