QueuePoolOption::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace Wanghanlin\QueuePool;
4
5
use Illuminate\Queue\WorkerOptions;
6
7
class QueuePoolOption extends WorkerOptions
8
{
9
    /**
10
     * The amount of pool worker need to start.
11
     *
12
     * @var int
13
     */
14
    public $workers;
15
16
    /**
17
     * The environment the pool worker should run in.
18
     *
19
     * @var string
20
     */
21
    public $environment;
22
23
    /**
24
     * Create a new pool options instance.
25
     *
26
     * @param  int  $workers
27
     * @param  string $environment
28
     * @param  int  $delay
29
     * @param  int  $memory
30
     * @param  int  $timeout
31
     * @param  int  $sleep
32
     * @param  int  $maxTries
33
     * @param  bool  $force
34
     * @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...
35
     */
36
    public function __construct($workers = 1, $environment = null, $delay = 0, $memory = 128, $timeout = 60, $sleep = 3, $maxTries = 0, $force = false)
37
    {
38
        $this->workers = $workers;
39
        $this->environment = $environment;
40
        parent::__construct($delay, $memory, $timeout, $sleep, $maxTries, $force);
41
    }
42
}
43