src/Ridvanbaluyos/Mmda/MMDA.php
final private function sanitizeTrafficData(Array $trafficData)
    {
        $traffic = [];
        foreach ($trafficData as $highway=>$segments) {
            $traffic[$highway] = [
                'name' => $highway,
                'label' => $this->convertToTitle($highway),
            ];
            $traffic[$highway]['segments'] = [];
            $dataSegments = [];

            foreach ($segments as $segment=>$status) {
                $dataSegments[$segment] = [
                    'name' => $segment,
                    'label' => $this->convertToTitle($segment),
                    'status' => $this->convertToStatus($status),

                ];
                $traffic[$highway]['segments'] = $dataSegments;
            }
        }

        return $traffic;
    }
final private function sanitizeTrafficData(Array $trafficData)
    {
        $traffic = [];
        foreach ($trafficData as $highway=>$segments) {
            $traffic[$highway] = [
                'name' => $highway,
                'label' => $this->convertToTitle($highway),
            ];
            $traffic[$highway]['segments'] = [];
            $dataSegments = [];

            foreach ($segments as $segment=>$status) {
                $dataSegments[$segment] = [
                    'name' => $segment,
                    'label' => $this->convertToTitle($segment),
                    'status' => $this->convertToStatus($status),

                ];
                $traffic[$highway]['segments'] = $dataSegments;
            }
        }

        return $traffic;
    }
final private function sanitizeTrafficData ( Array $ trafficData ) { $ traffic = [ ] ; foreach ( $ trafficData as $ highway => $ segments ) { $ traffic [ $ highway ] = [ 'name' => $ highway , 'label' => $ this -> convertToTitle ( $ highway ) , ] ; $ traffic [ $ highway ] [ 'segments' ] = [ ] ; $ dataSegments = [ ] ; foreach ( $ segments as $ segment => $ status ) { $ dataSegments [ $ segment ] = [ 'name' => $ segment , 'label' => $ this -> convertToTitle ( $ segment ) , 'status' => $ this -> convertToStatus ( $ status ) , ] ; $ traffic [ $ highway ] [ 'segments' ] = $ dataSegments ; } } return $ traffic ; }
This function sanitizes the traffic data and organizes them into an envelope

@param array $trafficData
@return array
This function sanitizes the traffic data and organizes them into an envelope