Generating::generate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 18/08/15
5
 * Time: 19:51
6
 */
7
8
namespace Del\Bitcoin\Api;
9
10
11
class Generating extends AbstractApi
12
{
13
    /**
14
     * The generate RPC nearly instantly generates
15
     * blocks (in regtest mode only)
16
     *
17
     * @param int $blocks The number of blocks to generate. The RPC call
18
     * will not return until all blocks have been generated
19
     * @return mixed
20
     */
21
    public function generate($blocks)
22
    {
23
        return $this->send('generate',[$blocks]);
24
    }
25
26
    /**
27
     * The getgenerate RPC returns true if the node is set to
28
     * generate blocks using its CPU.
29
     *
30
     * @return mixed
31
     */
32
    public function getGenerate()
33
    {
34
        return $this->send('getgenerate');
35
    }
36
37
    /**
38
     * The setgenerate RPC enables or disables hashing to attempt
39
     * to find the next block.
40
     *
41
     * @param bool $enable Set to true to enable generation;
42
     * set to false to disable generation
43
     * @param int $processors The number of processors to use. Defaults to 1.
44
     * Set to -1 to use all processors
45
     * @return mixed
46
     */
47
    public function setGenerate($enable,$processors)
48
    {
49
        return $this->send('setgenerate',[$enable,$processors]);
50
    }
51
}