winner_path = isset( $this->step_data['sidebarData']['winner'] ) ? intval( $this->step_data['sidebarData']['winner'] ) : 0; /** If winner path is declared then no need to populate other data */ if ( $this->winner_path > 0 ) { return true; } $this->total_paths = isset( $this->step_data['sidebarData']['split_path'] ) ? $this->step_data['sidebarData']['split_path'] : $this->total_paths; $this->last_run_path = isset( $this->step_data['sidebarData']['last_run'] ) ? intval( $this->step_data['sidebarData']['last_run'] ) : 0; return true; } /** * Get next run path * * @return int|mixed */ public function get_next_path() { /** If winner path is declared */ if ( $this->winner_path > 0 ) { return $this->winner_path; } $next_path = $this->last_run_path + 1; return ( intval( $this->total_paths ) >= intval( $next_path ) ) ? $next_path : 1; } }