Code Duplication    Length = 14-14 lines in 2 locations

class-gamajo-dashboard-glancer.php 1 location

@@ 123-136 (lines=14) @@
120
	 * @param array $item Registered item.
121
	 * @return string Markup, or empty string if item count is zero.
122
	 */
123
	protected function get_single_item( array $item ) {
124
		$num_posts = wp_count_posts( $item['type'] );
125
		$count     = (int) $num_posts->{$item['status']};
126
127
		if ( ! $count ) {
128
			return '';
129
		}
130
131
		$href = $this->get_link_url( $item );
132
		$text = number_format_i18n( $count ) . ' ' . $this->get_label( $item, $count );
133
		$text = $this->maybe_link( $text, $href );
134
135
		return $this->get_markup( $text, $item['type'] );
136
	}
137
138
	/**
139
	 * Get the singular or plural label for an item.

class-gamajo-dashboard-rightnow.php 1 location

@@ 43-56 (lines=14) @@
40
	 * @param array $item Registered item.
41
	 * @return string Markup, or empty string if item count is zero.
42
	 */
43
	protected function get_single_item( array $item ) {
44
		$num_posts = wp_count_posts( $item['type'] );
45
		$count = $num_posts->{$item['status']};
46
47
		if ( ! $count ) {
48
			return '';
49
		}
50
51
		$href = $this->get_link_url( $item );
52
		$num  = $this->maybe_link( number_format_i18n( $count ), $href );
53
		$text = $this->maybe_link( $this->get_label( $item, $count ), $href );
54
55
		return $this->get_markup( $num . '|' . $text, $item['type'] );
56
	}
57
58
	/**
59
	 * Wrap number and text within table row markup.