Completed
Pull Request — develop (#1282)
by David
07:16 queued 04:07
created

Sync_Background_Process_Stopped_State::enter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Wordlift\Dataset\Background;
4
5
class Sync_Background_Process_Stopped_State extends Abstract_Sync_Background_Process_State {
6
7
	/**
8
	 * @var Sync_Background_Process
9
	 */
10
	private $context;
11
12
	function __construct( $context ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
13
		parent::__construct( Sync_Background_Process::STATE_STOPPED );
14
15
		$this->context = $context;
16
	}
17
18
	function enter() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
19
		$this->context->set_state( Sync_Background_Process::STATE_STOPPED );
20
	}
21
22
	function leave() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
		$this->context->set_state( null );
24
	}
25
26
	function task( $item ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
28
		$this->context->cancel_process();
29
30
		return false;
31
	}
32
33
}
34