BlockingConsumerData::toJson()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of laravel-quota
5
 *
6
 * (c) David Faith <[email protected]>
7
 *
8
 * Full copyright and license information is available
9
 * in the LICENSE file distributed with this source code.
10
 */
11
12
namespace Projectmentor\Quota\Stubs;
13
14
use Projectmentor\Quota\Contracts\PayloadInterface;
15
use Projectmentor\Quota\Contracts\FactoryInterface;
16
17
/**
18
 * This is the BlockingConsumer data class.
19
 *
20
 * It stubs constructor parameters for:
21
 * bandwithThottle\tokenBucket\BlockingConsumer
22
 *
23
 * Initial properties for a new BlockingConsumer instance via
24
 * \Projectmentor\Quota\Factories\FactoryInterface
25
 *
26
 * @author David Faith <[email protected]>
27
 */
28
class BlockingConsumerData implements PayloadInterface
29
{
30
    /**
31
     * The TokenBucket.
32
     * @var bandwithThottle\tokenBucket\TokenBucket
33
     */
34
    protected $bucket;
35
36
    /**
37
     * Initialize $this
38
     * @param bandwithThottle\tokenBucket\TokenBucket
39
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
40
     */
41
    public function __construct($bucket)
42
    {
43
        $this->bucket = $bucket;
44
    }
45
46
    /**
47
     * Get the bucket instance.
48
     * @return bandwithThottle\tokenBucket\TokenBucket
49
     */
50
    public function getBucket()
51
    {
52
        return $this->bucket;
53
    }
54
55
    /**
56
     * Implements PayloadInterface
57
     * emit json payload.
58
     * @return string
59
     */
60
    public function toJson()
61
    {
62
        return 'Hi';
63
    }
64
65
    /**
66
     * Implements PayloadInterface
67
     * emit array payload.
68
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string[]?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
69
     */
70
    public function toArray()
71
    {
72
        return ['Hi'];
73
    }
74
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
75