Code Duplication    Length = 55-55 lines in 2 locations

src/wordlift/common/background-process/class-sync-state.php 1 location

@@ 5-59 (lines=55) @@
2
3
namespace Wordlift\Common\Background_Process;
4
5
class Sync_State {
6
7
	public $started;
8
	public $index;
9
	public $count;
10
	public $last_update;
11
	public $state;
12
13
	/**
14
	 * Sync_Model constructor.
15
	 *
16
	 * @param $started
17
	 * @param $index
18
	 * @param $count
19
	 * @param $last_update
20
	 * @param $state
21
	 */
22
	public function __construct( $started, $index, $count, $last_update, $state ) {
23
		$this->started     = $started;
24
		$this->index       = $index;
25
		$this->count       = (int) $count;
26
		$this->last_update = $last_update;
27
		$this->state       = $state;
28
	}
29
30
	public function increment_index( $count ) {
31
		$this->index       += $count;
32
		$this->last_update = time();
33
34
		return $this;
35
	}
36
37
	public function set_state( $value ) {
38
		$this->state       = $value;
39
		$this->last_update = time();
40
41
		return $this;
42
	}
43
44
	public function get_array() {
45
		return array(
46
			'started'     => $this->started,
47
			'index'       => $this->index,
48
			'count'       => $this->count,
49
			'last_update' => $this->last_update,
50
			'state'       => $this->state
51
		);
52
	}
53
54
	public static function unknown() {
55
56
		return new self( time(), 0, 0, time(), 'unknown' );
57
	}
58
59
}

src/wordlift/vocabulary/class-sync-state.php 1 location

@@ 5-59 (lines=55) @@
2
3
namespace Wordlift\Vocabulary;
4
5
class Sync_State {
6
7
	public $started;
8
	public $index;
9
	public $count;
10
	public $last_update;
11
	public $state;
12
13
	/**
14
	 * Sync_Model constructor.
15
	 *
16
	 * @param $started
17
	 * @param $index
18
	 * @param $count
19
	 * @param $last_update
20
	 * @param $state
21
	 */
22
	public function __construct( $started, $index, $count, $last_update, $state ) {
23
		$this->started     = $started;
24
		$this->index       = $index;
25
		$this->count       = (int) $count;
26
		$this->last_update = $last_update;
27
		$this->state       = $state;
28
	}
29
30
	public function increment_index( $count ) {
31
		$this->index       += $count;
32
		$this->last_update = time();
33
34
		return $this;
35
	}
36
37
	public function set_state( $value ) {
38
		$this->state       = $value;
39
		$this->last_update = time();
40
41
		return $this;
42
	}
43
44
	public function get_array() {
45
		return array(
46
			'started'     => $this->started,
47
			'index'       => $this->index,
48
			'count'       => $this->count,
49
			'last_update' => $this->last_update,
50
			'state'       => $this->state
51
		);
52
	}
53
54
	public static function unknown() {
55
56
		return new self( time(), 0, 0, time(), 'unknown' );
57
	}
58
59
}