Completed
Branch feature-persistent-connect (647c46)
by Evgenij
03:19
created

NullOperation::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
namespace AsyncSockets\Operation;
11
12
/**
13
 * Class NullOperation. Special no-value operation. Do not use in your code!
14
 */
15
class NullOperation implements OperationInterface
16
{
17
    /**
18
     * Return single instance of operation
19
     *
20
     * @return NullOperation
21
     */
22 49
    public static function getInstance()
23
    {
24 49
        static $instance;
25 49
        if (!$instance) {
26 1
            $instance = new self();
27 1
        }
28
29 49
        return $instance;
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35 1
    public function getType()
36
    {
37 1
        return self::OPERATION_READ;
38
    }
39
}
40