Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
renamed $eventCollection to $events
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-mabe committed May 7, 2012
1 parent efc14ed commit 8648880
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 60 deletions.
22 changes: 11 additions & 11 deletions src/Storage/Plugin/ClearByFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ class ClearByFactor extends AbstractPlugin
/**
* Attach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @param int $priority
* @return ClearByFactor
* @throws Exception\LogicException
*/
public function attach(EventManagerInterface $eventCollection, $priority = 1)
public function attach(EventManagerInterface $events, $priority = 1)
{
$index = spl_object_hash($eventCollection);
$index = spl_object_hash($events);
if (isset($this->handles[$index])) {
throw new Exception\LogicException('Plugin already attached');
}
Expand All @@ -62,31 +62,31 @@ public function attach(EventManagerInterface $eventCollection, $priority = 1)
$this->handles[$index] = & $handles;

$callback = array($this, 'clearByFactor');
$handles[] = $eventCollection->attach('setItem.post', $callback, $priority);
$handles[] = $eventCollection->attach('setItems.post', $callback, $priority);
$handles[] = $eventCollection->attach('addItem.post', $callback, $priority);
$handles[] = $eventCollection->attach('addItems.post', $callback, $priority);
$handles[] = $events->attach('setItem.post', $callback, $priority);
$handles[] = $events->attach('setItems.post', $callback, $priority);
$handles[] = $events->attach('addItem.post', $callback, $priority);
$handles[] = $events->attach('addItems.post', $callback, $priority);

return $this;
}

/**
* Detach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @return ClearByFactor
* @throws Exception\LogicException
*/
public function detach(EventManagerInterface $eventCollection)
public function detach(EventManagerInterface $events)
{
$index = spl_object_hash($eventCollection);
$index = spl_object_hash($events);
if (!isset($this->handles[$index])) {
throw new Exception\LogicException('Plugin not attached');
}

// detach all handles of this index
foreach ($this->handles[$index] as $handle) {
$eventCollection->detach($handle);
$events->detach($handle);
}

// remove all detached handles
Expand Down
72 changes: 36 additions & 36 deletions src/Storage/Plugin/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class ExceptionHandler extends AbstractPlugin
/**
* Attach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @param int $priority
* @return ExceptionHandler
* @throws Exception\LogicException
*/
public function attach(EventManagerInterface $eventCollection, $priority = 1)
public function attach(EventManagerInterface $events, $priority = 1)
{
$index = spl_object_hash($eventCollection);
$index = spl_object_hash($events);
if (isset($this->handles[$index])) {
throw new Exception\LogicException('Plugin already attached');
}
Expand All @@ -61,75 +61,75 @@ public function attach(EventManagerInterface $eventCollection, $priority = 1)
$this->handles[$index] = & $handles;

// read
$handles[] = $eventCollection->attach('getItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('getItems.exception', $callback, $priority);
$handles[] = $events->attach('getItem.exception', $callback, $priority);
$handles[] = $events->attach('getItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('hasItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('hasItems.exception', $callback, $priority);
$handles[] = $events->attach('hasItem.exception', $callback, $priority);
$handles[] = $events->attach('hasItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('getMetadata.exception', $callback, $priority);
$handles[] = $eventCollection->attach('getMetadatas.exception', $callback, $priority);
$handles[] = $events->attach('getMetadata.exception', $callback, $priority);
$handles[] = $events->attach('getMetadatas.exception', $callback, $priority);

// non-blocking
$handles[] = $eventCollection->attach('getDelayed.exception', $callback, $priority);
$handles[] = $eventCollection->attach('find.exception', $callback, $priority);
$handles[] = $events->attach('getDelayed.exception', $callback, $priority);
$handles[] = $events->attach('find.exception', $callback, $priority);

$handles[] = $eventCollection->attach('fetch.exception', $callback, $priority);
$handles[] = $eventCollection->attach('fetchAll.exception', $callback, $priority);
$handles[] = $events->attach('fetch.exception', $callback, $priority);
$handles[] = $events->attach('fetchAll.exception', $callback, $priority);

// write
$handles[] = $eventCollection->attach('setItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('setItems.exception', $callback, $priority);
$handles[] = $events->attach('setItem.exception', $callback, $priority);
$handles[] = $events->attach('setItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('addItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('addItems.exception', $callback, $priority);
$handles[] = $events->attach('addItem.exception', $callback, $priority);
$handles[] = $events->attach('addItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('replaceItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('replaceItems.exception', $callback, $priority);
$handles[] = $events->attach('replaceItem.exception', $callback, $priority);
$handles[] = $events->attach('replaceItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('touchItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('touchItems.exception', $callback, $priority);
$handles[] = $events->attach('touchItem.exception', $callback, $priority);
$handles[] = $events->attach('touchItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('removeItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('removeItems.exception', $callback, $priority);
$handles[] = $events->attach('removeItem.exception', $callback, $priority);
$handles[] = $events->attach('removeItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('checkAndSetItem.exception', $callback, $priority);
$handles[] = $events->attach('checkAndSetItem.exception', $callback, $priority);

// increment / decrement item(s)
$handles[] = $eventCollection->attach('incrementItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('incrementItems.exception', $callback, $priority);
$handles[] = $events->attach('incrementItem.exception', $callback, $priority);
$handles[] = $events->attach('incrementItems.exception', $callback, $priority);

$handles[] = $eventCollection->attach('decrementItem.exception', $callback, $priority);
$handles[] = $eventCollection->attach('decrementItems.exception', $callback, $priority);
$handles[] = $events->attach('decrementItem.exception', $callback, $priority);
$handles[] = $events->attach('decrementItems.exception', $callback, $priority);

// clear
$handles[] = $eventCollection->attach('clear.exception', $callback, $priority);
$handles[] = $eventCollection->attach('clearByNamespace.exception', $callback, $priority);
$handles[] = $events->attach('clear.exception', $callback, $priority);
$handles[] = $events->attach('clearByNamespace.exception', $callback, $priority);

// additional
$handles[] = $eventCollection->attach('optimize.exception', $callback, $priority);
$handles[] = $eventCollection->attach('getCapacity.exception', $callback, $priority);
$handles[] = $events->attach('optimize.exception', $callback, $priority);
$handles[] = $events->attach('getCapacity.exception', $callback, $priority);

return $this;
}

/**
* Detach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @return ExceptionHandler
* @throws Exception\LogicException
*/
public function detach(EventManagerInterface $eventCollection)
public function detach(EventManagerInterface $events)
{
$index = spl_object_hash($eventCollection);
$index = spl_object_hash($events);
if (!isset($this->handles[$index])) {
throw new Exception\LogicException('Plugin not attached');
}

// detach all handles of this index
foreach ($this->handles[$index] as $handle) {
$eventCollection->detach($handle);
$events->detach($handle);
}

// remove all detached handles
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Plugin/IgnoreUserAbort.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class IgnoreUserAbort extends AbstractPlugin
/**
* Attach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @param int $priority
* @return Serializer
* @throws Exception\LogicException
Expand Down
22 changes: 11 additions & 11 deletions src/Storage/Plugin/OptimizeByFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class OptimizeByFactor extends AbstractPlugin
/**
* Attach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @param int $priority
* @return OptimizeByFactor
* @throws Exception\LogicException
*/
public function attach(EventManagerInterface $eventCollection, $priority = 1)
public function attach(EventManagerInterface $events, $priority = 1)
{
$index = spl_object_hash($eventCollection);
$index = spl_object_hash($events);
if (isset($this->handles[$index])) {
throw new Exception\LogicException('Plugin already attached');
}
Expand All @@ -61,31 +61,31 @@ public function attach(EventManagerInterface $eventCollection, $priority = 1)
$this->handles[$index] = & $handles;

$callback = array($this, 'optimizeByFactor');
$handles[] = $eventCollection->attach('removeItem.post', $callback, $priority);
$handles[] = $eventCollection->attach('removeItems.post', $callback, $priority);
$handles[] = $eventCollection->attach('clear.post', $callback, $priority);
$handles[] = $eventCollection->attach('clearByNamespace.post', $callback, $priority);
$handles[] = $events->attach('removeItem.post', $callback, $priority);
$handles[] = $events->attach('removeItems.post', $callback, $priority);
$handles[] = $events->attach('clear.post', $callback, $priority);
$handles[] = $events->attach('clearByNamespace.post', $callback, $priority);

return $this;
}

/**
* Detach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @return OptimizeByFactor
* @throws Exception\LogicException
*/
public function detach(EventManagerInterface $eventCollection)
public function detach(EventManagerInterface $events)
{
$index = spl_object_hash($eventCollection);
$index = spl_object_hash($events);
if (!isset($this->handles[$index])) {
throw new Exception\LogicException('Plugin not attached');
}

// detach all handles of this index
foreach ($this->handles[$index] as $handle) {
$eventCollection->detach($handle);
$events->detach($handle);
}

// remove all detached handles
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Plugin/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Serializer extends AbstractPlugin
/**
* Attach
*
* @param EventManagerInterface $eventCollection
* @param EventManagerInterface $events
* @param int $priority
* @return Serializer
* @throws Exception\LogicException
Expand Down

0 comments on commit 8648880

Please sign in to comment.