Visualizing data from JSON

Simple visualization of data from input JSON

Example 1 | Settings array

1. Show All teams image

2. Bronze match available and we show it

3. Bronze match available in list but we need correction for Final match

                
                $file = 'https://raw.githubusercontent.com/openfootball/world-cup.json/master/2014/worldcup.json';

                $json = file_get_contents($file);
                $obj = json_decode($json);
                $teams_d = array();
                $teams_h = array();
                $teams_a = array();
                
                foreach($obj->rounds as $matchdays){
                    foreach($matchdays->matches as $match){
                        if(isset($match->knockout)){
                            if($match->knockout == true){
                                $teams_h["name"] = $match->team1->name;
                                $teams_h["score"] = $match->score1;
                                $teams_h["et_score"] = $match->score1et;
                                $teams_h["pt_score"] = $match->score1p;
                
                                $teams_a["name"] = $match->team2->name;
                                $teams_a["score"] = $match->score2;
                                $teams_a["et_score"] = $match->score2et;
                                $teams_a["pt_score"] = $match->score2p;
                
                                $teams_d[] = $teams_h;
                                $teams_d[] = $teams_a;
                            }
                        }
                    }
                }

                $settings = array('image'=>true, 'bronze'=>true, 'nobronze' =>true);
                $brackets = new Visualizer($teams_d, $settings);
                echo $brackets->RenderFromData();   
                
                
Round of 16
Quarter-Finals
Semi-Finals
Final
Brazil
3
Chile
2
Colombia
2
Uruguay
0
Netherlands
2
Mexico
1
Costa Rica
5
Greece
3
France
2
Nigeria
0
Germany
0
Algeria
0
Argentina
0
Switzerland
0
Belgium
0
United States
0
Brazil
2
Colombia
1
France
0
Germany
1
Netherlands
4
Costa Rica
3
Argentina
1
Belgium
0
Brazil
1
Germany
7
Netherlands
2
Argentina
4
Germany
0
Argentina
0
3-rd place
Brazil
0
Netherlands
3