Skip to content

Commit

Permalink
= defensive exception
Browse files Browse the repository at this point in the history
  • Loading branch information
marcmascarell committed Oct 28, 2015
1 parent d1eda9a commit ca21da3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Event/AbstractEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class AbstractEvent implements EventInterface {

/**
* Event name => method name
* Event name => Extension method name
*
* @var array
*/
Expand Down
16 changes: 12 additions & 4 deletions src/Manager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Mascame\Extender;

use Mascame\Extender\Booter\Booter;
use Mascame\Extender\Booter\BooterInterface;
use Mascame\Extender\Event\EventInterface;
use Mascame\Extender\Installer\InstallerInterface;
Expand Down Expand Up @@ -59,12 +60,12 @@ public function __construct(
* @throws \Exception
*/
protected function setBooter($booter) {
if ($booter && is_a($booter, BooterInterface::class)) {
$this->booter = $booter;
$this->booter->setManager($this);
} else if ($booter) {
if (! $booter || ! is_a($booter, BooterInterface::class)) {
throw new \Exception('Booter must implement BooterInterface');
}

$this->booter = $booter;
$this->booter->setManager($this);
}

/**
Expand Down Expand Up @@ -92,6 +93,13 @@ public function installer() {
return $this->installer;
}

/**
* @return EventInterface
*/
public function eventDispatcher() {
return $this->eventDispatcher;
}

/**
* @return array
*/
Expand Down

0 comments on commit ca21da3

Please sign in to comment.