Code Duplication    Length = 18-21 lines in 2 locations

src/wordlift/vocabulary/class-analysis-background-service.php 2 locations

@@ 54-71 (lines=18) @@
51
	 * A list of term ids.
52
	 * @return int|\WP_Error|\WP_Term[]
53
	 */
54
	public function next() {
55
56
		$state = $this->info();
57
58
		return get_terms( array(
59
			'fields'     => 'ids',
60
			'taxonomy'   => 'post_tag',
61
			'hide_empty' => false,
62
			'number'     => $this->get_batch_size(),
63
			'offset'     => $state->index,
64
			'meta_query' => array(
65
				array(
66
					'key'     => self::ANALYSIS_DONE_FLAG,
67
					'compare' => 'NOT EXISTS'
68
				)
69
			),
70
		) );
71
	}
72
73
	public function count() {
74
@@ 73-93 (lines=21) @@
70
		) );
71
	}
72
73
	public function count() {
74
75
		$count = count( get_terms( array(
76
			'fields'     => 'ids',
77
			'taxonomy'   => 'post_tag',
78
			'hide_empty' => false,
79
			// return all terms, we cant pass -1 here.
80
			'number'     => 0,
81
			'meta_query' => array(
82
				array(
83
					'key'     => self::ANALYSIS_DONE_FLAG,
84
					'compare' => 'NOT EXISTS'
85
				)
86
			),
87
		) ) );
88
89
		$this->log->debug( "Count returned as $count" );
90
91
92
		return $count;
93
	}
94
95
	public function get_batch_size() {
96
		return 10;