Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 72-87 (lines=16) @@
69
		$action  = $this->get_action_key();
70
		$this->log->debug( "Trying to start  ${action}..." );
71
		// Create a new Sync_Model state of `started`.
72
		if ( ! $this->is_started( self::get_state() ) ) {
73
			$this->log->debug( "Starting..." );
74
75
			$sync_state = new Sync_State( time(), 0, $this->data_source->count(), time(), 'started' );
76
			update_option( $this->get_state_storage_key(), $sync_state, false );
77
78
			$next = $this->data_source->next();
79
80
			$this->push_to_queue( $next );
81
			$this->save()->dispatch();
82
83
			if ( $next && is_array($next) ) {
84
				$this->log->debug( sprintf( 'Started with term IDs %s.', implode( ', ', $next ) ) );
85
			}
86
			return true;
87
		}
88
89
		return false;
90
	}

src/wordlift/vocabulary/class-analysis-background-process.php 1 location

@@ 72-87 (lines=16) @@
69
	public function start() {
70
		$this->log->debug( "Trying to start analysis bg service..." );
71
		// Create a new Sync_Model state of `started`.
72
		if ( ! $this->is_started( self::get_state() ) ) {
73
			$this->log->debug( "Starting..." );
74
75
			$sync_state = new Sync_State( time(), 0, $this->analysis_background_service->count(), time(), 'started' );
76
			update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $sync_state, false );
77
78
			$next = $this->analysis_background_service->next();
79
80
			$this->push_to_queue( $next );
81
			$this->save()->dispatch();
82
83
			if ( $next && is_array($next) ) {
84
				$this->log->debug( sprintf( 'Started with term IDs %s.', implode( ', ', $next ) ) );
85
			}
86
			return true;
87
		}
88
89
		return false;
90
	}