src/MIBS/Routes.php
public function routeDetails($translate = false) {
        $fetchList = [
            'routeDest' => 'destination',
            'routeMask' => 'mask',
            'routeTos' => 'TOS',
            'routeNextHop' => 'nextHop',
            'routeIfIndex' => 'ifIndex',
            'routeType' => 'type',
            'routeProto' => 'protocol',
            'routeAge' => 'age',
            'routeInfo' => 'info',
            'routeNextHopAS' => 'nextHopAS',
            'routeMetric1' => 'metric1',
            'routeMetric2' => 'metric2',
            'routeMetric3' => 'metric3',
            'routeMetric4' => 'metric4',
            'routeMetric5' => 'metric5',
            'routeStatus' => 'status'
        ];
        $canTranslate = [ 'routeType', 'routeProto', 'routeStatus'];
        $details = [];

        foreach ($fetchList as $fn => $idx) {
            if (in_array($fn, $canTranslate))
                $values = $this->$fn($translate);
            else
                $values = $this->$fn();
            foreach ($values as $ip => $value)
                $details[$ip][$idx] = $value;
        }
        return $details;
    }
public function routeDetails($translate = false) {
        $fetchList = [
            'routeDest' => 'destination',
            'routeMask' => 'mask',
            'routeTos' => 'TOS',
            'routeNextHop' => 'nextHop',
            'routeIfIndex' => 'ifIndex',
            'routeType' => 'type',
            'routeProto' => 'protocol',
            'routeAge' => 'age',
            'routeInfo' => 'info',
            'routeNextHopAS' => 'nextHopAS',
            'routeMetric1' => 'metric1',
            'routeMetric2' => 'metric2',
            'routeMetric3' => 'metric3',
            'routeMetric4' => 'metric4',
            'routeMetric5' => 'metric5',
            'routeStatus' => 'status'
        ];
        $canTranslate = [ 'routeType', 'routeProto', 'routeStatus'];
        $details = [];

        foreach ($fetchList as $fn => $idx) {
            if (in_array($fn, $canTranslate))
                $values = $this->$fn($translate);
            else
                $values = $this->$fn();
            foreach ($values as $ip => $value)
                $details[$ip][$idx] = $value;
        }
        return $details;
    }
public function routeDetails ( $ translate = false ) { $ fetchList = [ 'routeDest' => 'destination' , 'routeMask' => 'mask' , 'routeTos' => 'TOS' , 'routeNextHop' => 'nextHop' , 'routeIfIndex' => 'ifIndex' , 'routeType' => 'type' , 'routeProto' => 'protocol' , 'routeAge' => 'age' , 'routeInfo' => 'info' , 'routeNextHopAS' => 'nextHopAS' , 'routeMetric1' => 'metric1' , 'routeMetric2' => 'metric2' , 'routeMetric3' => 'metric3' , 'routeMetric4' => 'metric4' , 'routeMetric5' => 'metric5' , 'routeStatus' => 'status' ] ; $ canTranslate = [ 'routeType' , 'routeProto' , 'routeStatus' ] ; $ details = [ ] ; foreach ( $ fetchList as $ fn => $ idx ) { if ( in_array ( $ fn , $ canTranslate ) ) $ values = $ this -> $ fn ( $ translate ) ; else $ values = $ this -> $ fn ( ) ; foreach ( $ values as $ ip => $ value ) $ details [ $ ip ] [ $ idx ] = $ value ; } return $ details ; }
Utility function to gather all routes into a single array.
@param bool $translate Where a called function supports translation, if true then translate
@return array Array of routes
Utility function to gather all routes into a single array .