uecode /
qpush-bundle
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Copyright 2014 Underground Elephant |
||
| 5 | * |
||
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
| 7 | * you may not use this file except in compliance with the License. |
||
| 8 | * You may obtain a copy of the License at |
||
| 9 | * |
||
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
| 11 | * |
||
| 12 | * Unless required by applicable law or agreed to in writing, software |
||
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
| 15 | * See the License for the specific language governing permissions and |
||
| 16 | * limitations under the License. |
||
| 17 | * |
||
| 18 | * @package qpush-bundle |
||
| 19 | * @copyright Underground Elephant 2014 |
||
| 20 | * @license Apache License, Version 2.0 |
||
| 21 | */ |
||
| 22 | |||
| 23 | namespace Uecode\Bundle\QPushBundle\Provider; |
||
| 24 | |||
| 25 | use Doctrine\Common\Cache\Cache; |
||
| 26 | use Monolog\Logger; |
||
| 27 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
||
| 28 | use Uecode\Bundle\QPushBundle\Event\MessageEvent; |
||
| 29 | use Uecode\Bundle\QPushBundle\Event\NotificationEvent; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @author Keith Kirk <[email protected]> |
||
| 33 | */ |
||
| 34 | abstract class AbstractProvider implements ProviderInterface |
||
| 35 | { |
||
| 36 | /** |
||
| 37 | * QPush Queue Name |
||
| 38 | * |
||
| 39 | * @var string |
||
| 40 | */ |
||
| 41 | protected $name; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * QPush Queue Options |
||
| 45 | * |
||
| 46 | * @var array |
||
| 47 | */ |
||
| 48 | protected $options; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Doctrine APC Cache Driver |
||
| 52 | * |
||
| 53 | * @var Cache |
||
| 54 | */ |
||
| 55 | protected $cache; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Monolog Logger |
||
| 59 | * |
||
| 60 | * @var Logger |
||
| 61 | */ |
||
| 62 | protected $logger; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * {@inheritDoc} |
||
| 66 | */ |
||
| 67 | 3 | public function getName() |
|
| 68 | { |
||
| 69 | 3 | return $this->name; |
|
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * {@inheritDoc} |
||
| 74 | */ |
||
| 75 | 17 | public function getNameWithPrefix() |
|
| 76 | { |
||
| 77 | 17 | if (!empty($this->options['queue_name'])) { |
|
| 78 | 1 | return $this->options['queue_name']; |
|
| 79 | } |
||
| 80 | |||
| 81 | 16 | return sprintf("%s_%s", self::QPUSH_PREFIX, $this->name); |
|
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * {@inheritDoc} |
||
| 86 | */ |
||
| 87 | 1 | public function getOptions() |
|
| 88 | { |
||
| 89 | 1 | return $this->options; |
|
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * {@inheritDoc} |
||
| 94 | */ |
||
| 95 | 1 | public function getCache() |
|
| 96 | { |
||
| 97 | 1 | return $this->cache; |
|
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * {@inheritDoc} |
||
| 102 | */ |
||
| 103 | 1 | public function getlogger() |
|
| 104 | { |
||
| 105 | 1 | return $this->logger; |
|
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * {@inheritDoc} |
||
| 110 | */ |
||
| 111 | 20 | public function log($level, $message, array $context = []) |
|
| 112 | { |
||
| 113 | 20 | if (!$this->options['logging_enabled']) { |
|
| 114 | 20 | return false; |
|
| 115 | } |
||
| 116 | |||
| 117 | // Add the queue name and provider to the context |
||
| 118 | 1 | $context = array_merge(['queue' => $this->name, 'provider' => $this->getProvider()], $context); |
|
| 119 | |||
| 120 | 1 | return $this->logger->addRecord($level, $message, $context); |
|
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @param NotificationEvent $event |
||
| 125 | * @param string $eventName Name of the event |
||
| 126 | * @param EventDispatcherInterface $dispatcher |
||
| 127 | * @return bool |
||
| 128 | */ |
||
| 129 | 1 | public function onNotification(NotificationEvent $event, $eventName, EventDispatcherInterface $dispatcher) |
|
|
0 ignored issues
–
show
|
|||
| 130 | { |
||
| 131 | 1 | return false; |
|
| 132 | } |
||
| 133 | |||
| 134 | /** |
||
| 135 | * @param MessageEvent $event |
||
| 136 | * @return bool |
||
| 137 | */ |
||
| 138 | 1 | public function onMessageReceived(MessageEvent $event) |
|
| 139 | { |
||
| 140 | 1 | return false; |
|
| 141 | } |
||
| 142 | |||
| 143 | /** |
||
| 144 | * Merge override options while restricting what keys are allowed |
||
| 145 | * |
||
| 146 | * @param array $options An array of options that override the queue defaults |
||
| 147 | * |
||
| 148 | * @return array |
||
| 149 | */ |
||
| 150 | 7 | public function mergeOptions(array $options = []) |
|
| 151 | { |
||
| 152 | 7 | return array_merge($this->options, array_intersect_key($options, $this->options)); |
|
| 153 | } |
||
| 154 | |||
| 155 | abstract public function getProvider(); |
||
| 156 | |||
| 157 | abstract public function create(); |
||
| 158 | |||
| 159 | abstract public function publish(array $message, array $options = []); |
||
| 160 | |||
| 161 | abstract public function receive(array $options = []); |
||
| 162 | |||
| 163 | abstract public function delete($id); |
||
| 164 | |||
| 165 | abstract public function destroy(); |
||
| 166 | } |
||
| 167 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.