Passed
Push — master ( 0a782c...aa238d )
by Valentin
03:25
created

PheanstalkProxy::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 2
b 0
f 0
nc 2
nop 2
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Pyrowman\PheanstalkBundle\Proxy;
4
5
use Pheanstalk\Command\CreateScheduleCommand;
6
use Pheanstalk\Command\GetWorkflowInstancesCommand;
7
use Pheanstalk\Pheanstalk;
8
use Pheanstalk\Structure\Schedule;
9
use Pheanstalk\Structure\TaskInstance;
10
use Pheanstalk\Structure\TimeSchedule;
11
use Pheanstalk\Structure\Tube;
12
use Pheanstalk\Structure\Workflow;
13
use Pheanstalk\Structure\WorkflowInstance;
14
use Pyrowman\PheanstalkBundle\Event\CommandEvent;
15
use Pheanstalk\Connection;
16
use Pheanstalk\PheanstalkInterface;
17
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
18
19
class PheanstalkProxy implements PheanstalkProxyInterface
20
{
21
    /**
22
     * @var EventDispatcherInterface
23
     */
24
    protected $dispatcher;
25
26
    /**
27
     * @var string
28
     */
29
    protected $name;
30
31
    /**
32
     * @var Pheanstalk
33
     */
34
    protected $pheanstalk;
35
36
    /** @var $currentClass PheanstalkInterface */
0 ignored issues
show
Documentation Bug introduced by
The doc comment $currentClass at position 0 could not be parsed: Unknown type name '$currentClass' at position 0 in $currentClass.
Loading history...
37
    private $currentClass;
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    public function setConnection(Connection $connection)
43
    {
44
        $this->pheanstalk->setConnection($connection);
45
46
        return $this;
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function getConnection()
53
    {
54
        return $this->pheanstalk->getConnection();
55
    }
56
57
    /**
58
     * @return PheanstalkInterface
59
     */
60
    public function getCurrentClass(): PheanstalkInterface
61
    {
62
        return $this->currentClass ?? $this;
63
    }
64
65
    /**
66
     * @param PheanstalkInterface $currentClass
67
     *
68
     * @return Pheanstalk
69
     */
70
    public function setCurrentClass(PheanstalkInterface $currentClass): PheanstalkInterface
71
    {
72
        $this->currentClass = $currentClass;
73
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxy which is incompatible with the documented return type Pheanstalk\Pheanstalk.
Loading history...
74
    }
75
76
    /**
77
     * {@inheritDoc}
78
     */
79 1
    public function delete(Workflow $workflow)
80
    {
81 1
        if ($this->dispatcher) {
82 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::DELETE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...nt\CommandEvent::DELETE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

82
            $this->dispatcher->/** @scrutinizer ignore-call */ 
83
                               dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::DELETE);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
83
        }
84
85 1
        $this->pheanstalk->delete($workflow);
86
87 1
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxy which is incompatible with the return type mandated by Pheanstalk\PheanstalkInterface::delete() of boolean.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
88
    }
89
90
    /**
91
     * {@inheritDoc}
92
     */
93 1
    public function workflowExists($name)
94
    {
95 1
        if ($this->dispatcher) {
96 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['name' => $name]), CommandEvent::WORKFLOW_EXISTS);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...dEvent::WORKFLOW_EXISTS. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

96
            $this->dispatcher->/** @scrutinizer ignore-call */ 
97
                               dispatch(new CommandEvent($this, ['name' => $name]), CommandEvent::WORKFLOW_EXISTS);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
97
        }
98
99 1
        return $this->pheanstalk->workflowExists($name);
100
    }
101
102
    /**
103
     * {@inheritDoc}
104
     */
105 1
    public function getWorkflow(Workflow $workflow)
106
    {
107 1
        if ($this->dispatcher) {
108 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::TASK_EXISTS);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...mmandEvent::TASK_EXISTS. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

108
            $this->dispatcher->/** @scrutinizer ignore-call */ 
109
                               dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::TASK_EXISTS);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
109
        }
110
111 1
        return $this->pheanstalk->getWorkflow($workflow);
112
    }
113
114
    /**
115
     * {@inheritDoc}
116
     */
117 1
    public function getWorkflowInstances(?Workflow $workflow = null, ?string $status = null)
118
    {
119 1
        if ($this->dispatcher) {
120 1
            $this->dispatcher->dispatch(new CommandEvent($this, [
121 1
                'workflow'  => $workflow,
122 1
                'status'    => $status
123 1
            ]), CommandEvent::WORKFLOW_INSTANCES);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...ent::WORKFLOW_INSTANCES. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

123
            $this->dispatcher->/** @scrutinizer ignore-call */ 
124
                               dispatch(new CommandEvent($this, [

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
124
        }
125
126 1
        return $this->pheanstalk->getWorkflowInstances($workflow, $status);
127
    }
128
129
    /**
130
     * {@inheritDoc}
131
     */
132 1
    public function getWorkflowInstancesDetails(WorkflowInstance $workflowInstance)
133
    {
134 1
        if ($this->dispatcher) {
135 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflowInstance'  => $workflowInstance]),
136 1
                CommandEvent::WORKFLOW_INSTANCES_DETAILS);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...KFLOW_INSTANCES_DETAILS. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

136
            $this->dispatcher->/** @scrutinizer ignore-call */ 
137
                               dispatch(new CommandEvent($this, ['workflowInstance'  => $workflowInstance]),

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
137
        }
138
139 1
        return $this->pheanstalk->getWorkflowInstancesDetails($workflowInstance);
140
    }
141
142
    /**
143
     * {@inheritDoc}
144
     */
145 1
    public function tubeExists($name)
146
    {
147 1
        if ($this->dispatcher) {
148 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['name' => $name]), CommandEvent::TUBE_EXISTS);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...mmandEvent::TUBE_EXISTS. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

148
            $this->dispatcher->/** @scrutinizer ignore-call */ 
149
                               dispatch(new CommandEvent($this, ['name' => $name]), CommandEvent::TUBE_EXISTS);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
149
        }
150
151 1
        return $this->pheanstalk->tubeExists($name);
152
    }
153
154
    /**
155
     * {@inheritDoc}
156
     */
157 1
    public function listTubes()
158
    {
159 1
        if ($this->dispatcher) {
160 1
            $this->dispatcher->dispatch(new CommandEvent($this), CommandEvent::LIST_TUBES);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...ommandEvent::LIST_TUBES. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

160
            $this->dispatcher->/** @scrutinizer ignore-call */ 
161
                               dispatch(new CommandEvent($this), CommandEvent::LIST_TUBES);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
161
        }
162
163 1
        return $this->pheanstalk->listTubes();
164
    }
165
166
    /**
167
     * {@inheritDoc}
168
     */
169 1
    public function peek()
170
    {
171 1
        if ($this->dispatcher) {
172 1
            $this->dispatcher->dispatch(new CommandEvent($this), CommandEvent::PEEK);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundle\Event\CommandEvent::PEEK. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

172
            $this->dispatcher->/** @scrutinizer ignore-call */ 
173
                               dispatch(new CommandEvent($this), CommandEvent::PEEK);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
173
        }
174
175 1
        return $this->pheanstalk->peek();
176
    }
177
178
    /**
179
     * {@inheritDoc}
180
     */
181 1
    public function put(Workflow $workflow)
182
    {
183 1
        if ($this->dispatcher)
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
184 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::PUT);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundle\Event\CommandEvent::PUT. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

184
            $this->dispatcher->/** @scrutinizer ignore-call */ 
185
                               dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::PUT);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
185
186 1
        return $this->pheanstalk->put($workflow);
187
    }
188
189
    /**
190
     * {@inheritDoc}
191
     */
192 1
    public function statsTube(Tube $tube)
193
    {
194 1
        if ($this->dispatcher) {
195 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['tube' => $tube]), CommandEvent::STATS_TUBE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...ommandEvent::STATS_TUBE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

195
            $this->dispatcher->/** @scrutinizer ignore-call */ 
196
                               dispatch(new CommandEvent($this, ['tube' => $tube]), CommandEvent::STATS_TUBE);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
196
        }
197
198 1
        return $this->pheanstalk->statsTube($tube);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->pheanstalk->statsTube($tube) returns the type array which is incompatible with the return type mandated by Pheanstalk\PheanstalkInterface::statsTube() of object.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
199
    }
200
201
    /**
202
     * {@inheritDoc}
203
     */
204 2
    public function stats()
205
    {
206 2
        if ($this->dispatcher) {
207 2
            $this->dispatcher->dispatch(new CommandEvent($this), CommandEvent::STATS);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...ent\CommandEvent::STATS. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

207
            $this->dispatcher->/** @scrutinizer ignore-call */ 
208
                               dispatch(new CommandEvent($this), CommandEvent::STATS);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
208
        }
209
210 2
        return $this->pheanstalk->stats();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->pheanstalk->stats() returns the type array which is incompatible with the return type mandated by Pheanstalk\PheanstalkInterface::stats() of object.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
211
    }
212
213
    /**
214
     * @return EventDispatcherInterface
215
     */
216
    public function getDispatcher()
217
    {
218
        return $this->dispatcher;
219
    }
220
221
    /**
222
     * @param EventDispatcherInterface $dispatch
223
     */
224 25
    public function setDispatcher(EventDispatcherInterface $dispatch)
225
    {
226 25
        $this->dispatcher = $dispatch;
227
    }
228
229
    /**
230
     * {@inheritDoc}
231
     */
232 1
    public function getPheanstalk()
233
    {
234 1
        return $this->pheanstalk;
235
    }
236
237
    /**
238
     * {@inheritDoc}
239
     */
240 27
    public function setPheanstalk(PheanstalkInterface $pheanstalk)
241
    {
242 27
        $this->pheanstalk = $pheanstalk;
0 ignored issues
show
Documentation Bug introduced by
$pheanstalk is of type Pheanstalk\PheanstalkInterface, but the property $pheanstalk was declared to be of type Pheanstalk\Pheanstalk. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
243 27
        $this->pheanstalk->setCurrentClass($this);
244
245 27
        return $this;
246
    }
247
248
    /**
249
     * {@inheritDoc}
250
     */
251
    public function getName()
252
    {
253
        return $this->name;
254
    }
255
256
    /**
257
     * {@inheritDoc}
258
     */
259 1
    public function setName($name)
260
    {
261 1
        $this->name = $name;
262
263 1
        return $this;
264
    }
265
266
    /**
267
     * {@inheritdoc}
268
     */
269 2
    public function create(Workflow $workflow, $force = false): Workflow
270
    {
271 2
        if ($this->dispatcher) {
272 2
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::CREATE_WORKFLOW);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...dEvent::CREATE_WORKFLOW. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

272
            $this->dispatcher->/** @scrutinizer ignore-call */ 
273
                               dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::CREATE_WORKFLOW);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
273
        }
274
275 2
        $workflow = $this->pheanstalk->create($workflow);
276 2
        return $workflow;
277
    }
278
279
    /**
280
     * {@inheritdoc}
281
     */
282 1
    public function update(Workflow $workflow): Workflow
283
    {
284 1
        if ($this->dispatcher) {
285 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::UPDATE_WORKFLOW);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...dEvent::UPDATE_WORKFLOW. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

285
            $this->dispatcher->/** @scrutinizer ignore-call */ 
286
                               dispatch(new CommandEvent($this, ['workflow' => $workflow]), CommandEvent::UPDATE_WORKFLOW);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
286
        }
287
288 1
        return $this->pheanstalk->update($workflow);
289
    }
290
291
    /**
292
     * {@inheritdoc}
293
     */
294 1
    public function createSchedule(Schedule $schedule)
295
    {
296 1
        if ($this->dispatcher) {
297 1
            $this->dispatcher->dispatch(new CommandEvent($this, [
298 1
                'schedule'  => $schedule,
299 1
            ]), CommandEvent::CREATE_SCHEDULE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...dEvent::CREATE_SCHEDULE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

299
            $this->dispatcher->/** @scrutinizer ignore-call */ 
300
                               dispatch(new CommandEvent($this, [

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
300
        }
301
302 1
        $workflowSchedule = $this->pheanstalk->createSchedule($schedule);
303 1
        return $workflowSchedule;
304
    }
305
306
    /**
307
     * {@inheritdoc}
308
     */
309 1
    public function deleteSchedule(Schedule $schedule)
310
    {
311 1
        if ($this->dispatcher) {
312 1
            $this->dispatcher->dispatch(new CommandEvent($this, [
313 1
                'schedule'  => $schedule,
314 1
            ]), CommandEvent::DELETE_SCHEDULE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...dEvent::DELETE_SCHEDULE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

314
            $this->dispatcher->/** @scrutinizer ignore-call */ 
315
                               dispatch(new CommandEvent($this, [

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
315
        }
316
317 1
        return $this->pheanstalk->deleteSchedule($schedule);
318
    }
319
320
    /**
321
     * {@inheritdoc}
322
     */
323 1
    public function getSchedule(int $schedule)
324
    {
325 1
        if ($this->dispatcher) {
326 1
            $this->dispatcher->dispatch(new CommandEvent($this, [
327 1
                'schedule'  => $schedule,
328 1
            ]), CommandEvent::GET_SCHEDULE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...mandEvent::GET_SCHEDULE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

328
            $this->dispatcher->/** @scrutinizer ignore-call */ 
329
                               dispatch(new CommandEvent($this, [

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
329
        }
330
331 1
        return $this->pheanstalk->getSchedule($schedule);
332
    }
333
334
    /**
335
     * {@inheritdoc}
336
     */
337 1
    public function updateSchedule(Schedule $schedule): Schedule
338
    {
339 1
        if ($this->dispatcher) {
340 1
            $this->dispatcher->dispatch(new CommandEvent($this, [
341 1
                'schedule'  => $schedule,
342 1
            ]), CommandEvent::UPDATE_SCHEDULE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...dEvent::UPDATE_SCHEDULE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

342
            $this->dispatcher->/** @scrutinizer ignore-call */ 
343
                               dispatch(new CommandEvent($this, [

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
343
        }
344
345 1
        return $this->pheanstalk->updateSchedule($schedule);
346
    }
347
348
    /**
349
     * {@inheritdoc}
350
     */
351 1
    public function listSchedules()
352
    {
353 1
        if ($this->dispatcher) {
354 1
            $this->dispatcher->dispatch(new CommandEvent($this, []), CommandEvent::LIST_SCHEDULE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...andEvent::LIST_SCHEDULE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

354
            $this->dispatcher->/** @scrutinizer ignore-call */ 
355
                               dispatch(new CommandEvent($this, []), CommandEvent::LIST_SCHEDULE);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
355
        }
356
357 1
        return $this->pheanstalk->listSchedules();
358
    }
359
360
    /**
361
     * {@inheritdoc}
362
     */
363 1
    public function createTask(string $name, string $group, string $path, $queue = 'default', $useAgent = false, $user = null, $host = null, $comment = null): Workflow
364
    {
365 1
        if ($this->dispatcher) {
366 1
            $this->dispatcher->dispatch(new CommandEvent($this, [
367 1
                'name'      => $name,
368 1
                'group'     => $group,
369 1
                'path'      => $path,
370 1
                'queue'     => $queue,
371 1
                'useAgent'  => $useAgent,
372 1
                'user'      => $user,
373 1
                'host'      => $host,
374 1
                'comment'   => $comment
375 1
            ]), CommandEvent::CREATE_TASK);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...mmandEvent::CREATE_TASK. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

375
            $this->dispatcher->/** @scrutinizer ignore-call */ 
376
                               dispatch(new CommandEvent($this, [

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
376
        }
377
378 1
        return $this->pheanstalk->createTask($name, $group, $path, $queue, $useAgent, $user, $host, $comment);
379
    }
380
381
    /**
382
     * {@inheritdoc}
383
     */
384 1
    public function createTube(Tube $tube): Tube
385
    {
386 1
        if ($this->dispatcher) {
387 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['tube' => $tube]), COmmandEvent::CREATE_TUBE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...mmandEvent::CREATE_TUBE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

387
            $this->dispatcher->/** @scrutinizer ignore-call */ 
388
                               dispatch(new CommandEvent($this, ['tube' => $tube]), COmmandEvent::CREATE_TUBE);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
388
        }
389
390 1
        return $this->pheanstalk->createTube($tube);
391
    }
392
393
    /**
394
     * {@inheritdoc}
395
     */
396 1
    public function updateTube(Tube $tube): Tube
397
    {
398 1
        if ($this->dispatcher) {
399 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['tube' => $tube]), COmmandEvent::CREATE_TUBE);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...mmandEvent::CREATE_TUBE. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

399
            $this->dispatcher->/** @scrutinizer ignore-call */ 
400
                               dispatch(new CommandEvent($this, ['tube' => $tube]), COmmandEvent::CREATE_TUBE);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
400
        }
401
402 1
        return $this->pheanstalk->updateTube($tube);
403
    }
404
405
    /**
406
     * {@inheritdoc}
407
     */
408 1
    public function cancel(WorkflowInstance $workflowInstance)
409
    {
410 1
        if ($this->dispatcher) {
411 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflowInstance' => $workflowInstance]), COmmandEvent::CANCEL);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...nt\CommandEvent::CANCEL. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

411
            $this->dispatcher->/** @scrutinizer ignore-call */ 
412
                               dispatch(new CommandEvent($this, ['workflowInstance' => $workflowInstance]), COmmandEvent::CANCEL);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
412
        }
413
414 1
        return $this->pheanstalk->cancel($workflowInstance);
415
    }
416
417 1
    public function kill(WorkflowInstance $workflowInstance, TaskInstance $taskInstance)
418
    {
419 1
        if ($this->dispatcher) {
420 1
            $this->dispatcher->dispatch(new CommandEvent($this, ['workflowInstance' => $workflowInstance, 'taskInstance' => $taskInstance]), COmmandEvent::CANCEL);
0 ignored issues
show
Unused Code introduced by
The call to Symfony\Contracts\EventD...erInterface::dispatch() has too many arguments starting with Pyrowman\PheanstalkBundl...nt\CommandEvent::CANCEL. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

420
            $this->dispatcher->/** @scrutinizer ignore-call */ 
421
                               dispatch(new CommandEvent($this, ['workflowInstance' => $workflowInstance, 'taskInstance' => $taskInstance]), COmmandEvent::CANCEL);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
421
        }
422
423 1
        return $this->pheanstalk->kill($workflowInstance, $taskInstance);
424
    }
425
}
426