Completed
Push — master ( 9edfc5...0d667f )
by Evgenij
03:15
created

NullOperation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 9 2
A getTypes() 0 4 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2017, 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 51
    public static function getInstance()
23
    {
24 51
        static $instance;
25 51
        if (!$instance) {
26 1
            $instance = new self();
27 1
        }
28
29 51
        return $instance;
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35 2
    public function getTypes()
36
    {
37 2
        return [self::OPERATION_READ];
38
    }
39
}
40