Completed
Push — master ( 3ee305...36a69b )
by Ryan
07:04
created

GetStreams::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace Anomaly\Streams\Platform\Stream\Command;
2
3
use Anomaly\Streams\Platform\Stream\Contract\StreamRepositoryInterface;
4
use Illuminate\Contracts\Bus\SelfHandling;
5
6
/**
7
 * Class GetStreams
8
 *
9
 * @link          http://pyrocms.com/
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 * @package       Anomaly\Streams\Platform\Stream\Command
13
 */
14
class GetStreams implements SelfHandling
15
{
16
17
    /**
18
     * The stream namespace.
19
     *
20
     * @var string
21
     */
22
    protected $namespace;
23
24
    /**
25
     * Create a new GetStreams instance.
26
     *
27
     * @param string $namespace
28
     */
29
    public function __construct($namespace)
30
    {
31
        $this->namespace = $namespace;
32
    }
33
34
    /**
35
     * Handle the command.
36
     *
37
     * @param StreamRepositoryInterface $streams
38
     * @return \Anomaly\Streams\Platform\Stream\Contract\StreamInterface|null
39
     */
40
    public function handle(StreamRepositoryInterface $streams)
41
    {
42
        return $streams->findAllByNamespace($this->namespace);
43
    }
44
}
45