Skip to content

Commit

Permalink
Added custom kernel events
Browse files Browse the repository at this point in the history
* Added 8 kernel events
* All events class tested
* Fixed some CS
* Updated documentation and added Events docu
* Added phpunit definition file
  • Loading branch information
mmoreram committed Sep 1, 2013
1 parent fe67513 commit 62c7890
Show file tree
Hide file tree
Showing 37 changed files with 1,274 additions and 112 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ coverage
composer.lock
vendor
composer.phar
phpcs.lo
phpcs.log
2 changes: 2 additions & 0 deletions Command/GearmanCacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
class GearmanCacheClearCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -40,6 +41,7 @@ protected function configure()
->setDescription('Clears gearman cache data on current environment');
}


/**
* Executes the current command.
*
Expand Down
2 changes: 2 additions & 0 deletions Command/GearmanCacheWarmupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
class GearmanCacheWarmupCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -40,6 +41,7 @@ protected function configure()
->setDescription('Warms up gearman cache data');
}


/**
* Executes the current command.
*
Expand Down
2 changes: 2 additions & 0 deletions Command/GearmanJobDescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class GearmanJobDescribeCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -35,6 +36,7 @@ protected function configure()
->addArgument('job', InputArgument::REQUIRED, 'job to describe');
}


/**
* Executes the current command.
*
Expand Down
2 changes: 2 additions & 0 deletions Command/GearmanJobExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class GearmanJobExecuteCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -36,6 +37,7 @@ protected function configure()
->addOption('no-description', null, InputOption::VALUE_NONE, 'Don\'t print job description');
}


/**
* Executes the current command.
*
Expand Down
2 changes: 2 additions & 0 deletions Command/GearmanWorkerDescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class GearmanWorkerDescribeCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -35,6 +36,7 @@ protected function configure()
->addArgument('worker', InputArgument::REQUIRED, 'worker to describe');
}


/**
* Executes the current command.
*
Expand Down
2 changes: 2 additions & 0 deletions Command/GearmanWorkerExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class GearmanWorkerExecuteCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -36,6 +37,7 @@ protected function configure()
->addOption('no-description', null, InputOption::VALUE_NONE, 'Don\'t print worker description');
}


/**
* Executes the current command.
*
Expand Down
2 changes: 2 additions & 0 deletions Command/GearmanWorkerListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
class GearmanWorkerListCommand extends ContainerAwareCommand
{

/**
* Console Command configuration
*/
Expand All @@ -34,6 +35,7 @@ protected function configure()
->setDescription('List all Gearman Workers and their Jobs');
}


/**
* Executes the current command.
*
Expand Down
49 changes: 49 additions & 0 deletions Event/Abstracts/AbstractGearmanClientTaskEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event\Abstracts;

use Symfony\Component\EventDispatcher\Event;
use GearmanTask;


/**
* AbstractGearmanClientTaskEvent
*/
abstract class AbstractGearmanClientTaskEvent extends Event
{

/**
* @var GearmanTask
*
* Gearman task object
*/
protected $gearmanTask;


/**
* Construct method
*
* @param GearmanTask $gearmanTask Gearman Task
*/
public function __construct(\GearmanTask $gearmanTask)
{
$this->gearmanTask = $gearmanTask;
}


/**
* Get Gearman Task
*
* @return GearmanTask Gearman Task
*/
public function getGearmanTask()
{
return $this->gearmanTask;
}
}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackCompleteEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackCompleteEvent
*/
class GearmanClientCallbackCompleteEvent extends AbstractGearmanClientTaskEvent
{

}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackCreatedEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackCreatedEvent
*/
class GearmanClientCallbackCreatedEvent extends AbstractGearmanClientTaskEvent
{

}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackDataEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackDataEvent
*/
class GearmanClientCallbackDataEvent extends AbstractGearmanClientTaskEvent
{

}
18 changes: 18 additions & 0 deletions Event/GearmanClientCallbackExceptionEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;


/**
* GearmanClientCallbackExceptionEvent
*/
class GearmanClientCallbackExceptionEvent
{

}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackFailEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackFailEvent
*/
class GearmanClientCallbackFailEvent extends AbstractGearmanClientTaskEvent
{

}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackStatusEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackStatusEvent
*/
class GearmanClientCallbackStatusEvent extends AbstractGearmanClientTaskEvent
{

}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackWarningEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackWarningEvent
*/
class GearmanClientCallbackWarningEvent extends AbstractGearmanClientTaskEvent
{

}
20 changes: 20 additions & 0 deletions Event/GearmanClientCallbackWorkloadEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* RSQueueBundle for Symfony2
*
* Marc Morera 2013
*/

namespace Mmoreram\GearmanBundle\Event;

use Mmoreram\GearmanBundle\Event\Abstracts\AbstractGearmanClientTaskEvent;


/**
* GearmanClientCallbackWorkloadEvent
*/
class GearmanClientCallbackWorkloadEvent extends AbstractGearmanClientTaskEvent
{

}
13 changes: 0 additions & 13 deletions Exceptions/JobDoesNotExistException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,4 @@
class JobDoesNotExistException extends Exception
{

/**
* Construct method for Exception
*
* @param string $job Job name to be shown in Exception
* @param integer $code Code of exception
* @param Exception $previous Previos Exception
*/
public function __construct($job, $code = 0, Exception $previous = null)
{
$message = 'GearmanBundle can\'t find job with name ' . $job . PHP_EOL;

parent::__construct($message, $code, $previous);
}
}
33 changes: 0 additions & 33 deletions Exceptions/NoCallableGearmanMethodException.php

This file was deleted.

Loading

0 comments on commit 62c7890

Please sign in to comment.