Skip to content

Commit

Permalink
Change interface
Browse files Browse the repository at this point in the history
  • Loading branch information
oanhnn committed Jan 29, 2016
1 parent 4149aaf commit a5f6768
Show file tree
Hide file tree
Showing 15 changed files with 743 additions and 480 deletions.
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$header = <<<EOF
This file is part of `lemon/event` project.
This file is part of `lemonphp/event` project.
(c) 2015-2016 LemonPHP Team
Expand Down
17 changes: 0 additions & 17 deletions src/Dispatcher.php

This file was deleted.

152 changes: 0 additions & 152 deletions src/DispatcherAwareTrait.php

This file was deleted.

60 changes: 0 additions & 60 deletions src/DispatcherInterface.php

This file was deleted.

27 changes: 20 additions & 7 deletions src/Event.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of `lemon/event` project.
* This file is part of `lemonphp/event` project.
*
* (c) 2015-2016 LemonPHP Team
*
Expand All @@ -11,24 +11,35 @@

namespace Lemon\Event;

/**
* Event is the base class for classes containing event data.
*
* This class contains no event data. It is used by events that do not pass
* state information to an event handler when an event is raised.
*
* You can call the method stopPropagation() to abort the execution of
* further listeners in your event listener.
*/
class Event
{
/**
* Event type
*
* @var string Read only property
*/
protected $eventName;
protected $eventType;

/**
* @var bool Whether no further event listeners should be triggered
*/
protected $stopped = false;

/**
* @param string $name
* @param string $type
*/
public function __construct($name)
public function __construct($type)
{
$this->eventName = (string) $name;
$this->eventType = (string) $type;
}

/**
Expand All @@ -55,10 +66,12 @@ public function stopPropagation()
}

/**
* Get event type
*
* @return string
*/
public function getEventName()
public function getEventType()
{
return $this->eventName;
return $this->eventType;
}
}
24 changes: 24 additions & 0 deletions src/EventDispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of `lemonphp/event` project.
*
* (c) 2015-2016 LemonPHP Team
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Lemon\Event;

/**
* The EventDispatcher is the central point of Symfony's event listener system.
*
* Listeners are registered on the manager and events are dispatched through the
* manager.
*/
class EventDispatcher implements EventDispatcherInterface
{

use EventDispatcherAwareTrait;
}
Loading

0 comments on commit a5f6768

Please sign in to comment.