Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Support\Testing\Fakes;
4
 
5
use Closure;
6
use Illuminate\Foundation\Bus\PendingChain;
7
use Illuminate\Queue\CallQueuedClosure;
8
 
9
class PendingChainFake extends PendingChain
10
{
11
    /**
12
     * The fake bus instance.
13
     *
14
     * @var \Illuminate\Support\Testing\Fakes\BusFake
15
     */
16
    protected $bus;
17
 
18
    /**
19
     * Create a new pending chain instance.
20
     *
21
     * @param  \Illuminate\Support\Testing\Fakes\BusFake  $bus
22
     * @param  mixed  $job
23
     * @param  array  $chain
24
     * @return void
25
     */
26
    public function __construct(BusFake $bus, $job, $chain)
27
    {
28
        $this->bus = $bus;
29
        $this->job = $job;
30
        $this->chain = $chain;
31
    }
32
 
33
    /**
34
     * Dispatch the job with the given arguments.
35
     *
36
     * @return \Illuminate\Foundation\Bus\PendingDispatch
37
     */
38
    public function dispatch()
39
    {
40
        if (is_string($this->job)) {
41
            $firstJob = new $this->job(...func_get_args());
42
        } elseif ($this->job instanceof Closure) {
43
            $firstJob = CallQueuedClosure::create($this->job);
44
        } else {
45
            $firstJob = $this->job;
46
        }
47
 
48
        $firstJob->allOnConnection($this->connection);
49
        $firstJob->allOnQueue($this->queue);
50
        $firstJob->chain($this->chain);
51
        $firstJob->delay($this->delay);
52
        $firstJob->chainCatchCallbacks = $this->catchCallbacks();
53
 
54
        return $this->bus->dispatch($firstJob);
55
    }
56
}