te( 'Y-m-d', strtotime( '-2 days' ) ), 'position' => wp_rand( 1, 15 ), 'clicks' => wp_rand( 10, 100 ), ] ] ]; } return [ 'rows' => [ [ 'id' => 1, 'name' => 'best seo plugin', 'favorited' => false, 'groups' => [ [ 'id' => 1, 'name' => 'Blog Pages Group' ] ], 'statistics' => $statistics[1] ], [ 'id' => 2, 'name' => 'aioseo is the best', 'favorited' => true, 'groups' => [ [ 'id' => 2, 'name' => 'Low Performance Group' ] ], 'statistics' => $statistics[2] ], [ 'id' => 3, 'name' => 'analyze my seo', 'favorited' => false, 'groups' => [ [ 'id' => 3, 'name' => 'High Performance Group' ] ], 'statistics' => $statistics[3] ], [ 'id' => 4, 'name' => 'wordpress seo', 'favorited' => false, 'groups' => [], 'statistics' => $statistics[4] ], [ 'id' => 5, 'name' => 'best seo plugin pro', 'favorited' => false, 'groups' => [], 'statistics' => $statistics[5] ], [ 'id' => 6, 'name' => 'aioseo wordpress', 'favorited' => false, 'groups' => [], 'statistics' => $statistics[6] ], [ 'id' => 7, 'name' => 'headline analyzer aioseo', 'favorited' => false, 'groups' => [], 'statistics' => $statistics[7] ], [ 'id' => 8, 'name' => 'best seo plugin plugin', 'favorited' => false, 'groups' => [], 'statistics' => $statistics[8] ] ], 'totals' => [ 'total' => 8, 'pages' => 1, 'page' => 1 ], ]; } /** * Retrieves all the keyword groups, formatted. * * @since 4.7.0 * * @param array $args The arguments. * @return array The formatted keyword groups. */ public function getFormattedGroups( $args = [] ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable $statistics = []; for ( $i = 1; $i < 4; $i++ ) { $statistics[ $i ] = [ 'clicks' => wp_rand( 1, 1000 ), 'impressions' => wp_rand( 10, 10000 ), 'ctr' => wp_rand( 1, 99 ), 'position' => wp_rand( 1, 100 ) ]; } return [ 'rows' => [ [ 'id' => 1, 'name' => 'Blog Pages Group', 'keywordsQty' => 1, 'keywords' => [], 'statistics' => $statistics[1] ], [ 'id' => 2, 'name' => 'Low Performance Group', 'keywordsQty' => 1, 'keywords' => [], 'statistics' => $statistics[2] ], [ 'id' => 3, 'name' => 'High Performance Group', 'keywordsQty' => 1, 'keywords' => [], 'statistics' => $statistics[3] ] ], 'totals' => [ 'total' => 8, 'pages' => 1, 'page' => 1 ], ]; } /** * Returns the data for Vue. * * @since 4.7.0 * * @return array The data for Vue. */ public function getVueData() { $formattedKeywords = $this->getFormattedKeywords(); $formattedGroups = $this->getFormattedGroups(); return [ // Dummy data to show on the UI. 'keywords' => [ 'all' => $formattedKeywords, 'paginated' => $formattedKeywords, 'count' => count( $formattedKeywords['rows'] ), 'statistics' => $this->fetchKeywordsStatistics( $formattedKeywords ), ], 'groups' => [ 'all' => $formattedGroups, 'paginated' => $formattedGroups, 'count' => count( $formattedGroups['rows'] ), ], ]; } /** * Returns the data for Vue. * * @since 4.7.0 * * @return array The data. */ public function getVueDataEdit() { $formattedKeywords = $this->getFormattedKeywords(); return [ // Dummy data to show on the UI. 'keywords' => [ 'all' => $formattedKeywords, 'paginated' => $formattedKeywords, 'count' => count( $formattedKeywords['rows'] ), ], ]; } }