/**
  * {@inheritDoc}
  */
 protected function get($name)
 {
     $serviceId = parent::get($name);
     return $this->container->get($serviceId);
 }
 /**
  * {@inheritDoc}
  */
 protected function get($name)
 {
     return $this->pimple[parent::get($name)];
 }
示例#3
0
 /**
  * {@inheritDoc}
  */
 public function map(Envelope $envelope)
 {
     $callback = parent::map($envelope);
     $callback[1] = self::RECEIVE_METHOD_NAME;
     return $callback;
 }
 /**
  * {@inheritDoc}
  */
 protected function get($name)
 {
     return $this->container->make(parent::get($name));
 }
示例#5
0
include 'include/do_submit.php';
use Bernard\Router\SimpleRouter;
use Bernard\Consumer;
use Bernard\QueueFactory\PersistentFactory;
use Bernard\Message\DefaultMessage;
use Bernard\Producer;
use Bernard\Serializer;
use Symfony\Component\EventDispatcher\EventDispatcher;
class CDashSubmissionService
{
    public function doSubmit(DefaultMessage $message)
    {
        global $CDASH_BASE_URL, $CDASH_REMOTE_ADDR;
        // Since this could be running on a remote machine, spoof the IP
        // to appear as the IP that actually submitted the build
        $CDASH_REMOTE_ADDR = $message['submission_ip'];
        $result = do_submit($message['buildsubmissionid'], $message['projectid'], $message['expected_md5'], $message['do_checksum'], $message['submission_id']);
        // If the submission didn't explicitly fail, delete the submission XML to avoid
        // duplicate submissions
        if ($result !== false) {
            $client = new GuzzleHttp\Client();
            $response = $client->request('DELETE', $CDASH_BASE_URL . '/api/v1/deleteBuildSubmissionXml.php', array('query' => array('buildsubmissionid' => $message['buildsubmissiondid'])));
        }
    }
}
$router = new SimpleRouter();
$router->add('DoSubmit', new CDashSubmissionService());
$factory = new PersistentFactory($CDASH_BERNARD_DRIVER, new Serializer());
// Create a Consumer and start the loop.
$consumer = new Consumer($router, new EventDispatcher());
$consumer->consume($factory->create('do-submit'));
示例#6
0
 /**
  * PhpDiAwareRouter constructor.
  * @param ContainerInterface $container
  * @param array $receivers
  */
 public function __construct(ContainerInterface $container, array $receivers = [])
 {
     $this->container = $container;
     parent::__construct($receivers);
 }