private function arrayToMessageAndCode(array $array)
    {
        if (empty($array)) {
            return array(null,null);
        }
        if (1 == count($array)) {
            $item = array_pop($array);
            return array($item->message,$item->code);
        }

        $message = "";
        $code = "";
        foreach ($array as $item) {
            $message .= "Exception: ".$item->message . "\n";
            if (empty($code) && !empty($item->code)) {
                $code = $item->code;
            }
        }
        return array($message,$code);
    }
private function arrayToMessageAndCode(array $array)
    {
        if (empty($array)) {
            return array(null,null);
        }
        if (1 == count($array)) {
            $item = array_pop($array);
            return array($item->message,$item->code);
        }

        $message = "";
        $code = "";
        foreach ($array as $item) {
            $message .= "Exception: ".$item->message . "\n";
            if (empty($code) && !empty($item->code)) {
                $code = $item->code;
            }
        }
        return array($message,$code);
    }
private function arrayToMessageAndCode ( array $ array ) { if ( empty ( $ array ) ) { return array ( null , null ) ; } if ( 1 == count ( $ array ) ) { $ item = array_pop ( $ array ) ; return array ( $ item -> message , $ item -> code ) ; } $ message = "" ; $ code = "" ; foreach ( $ array as $ item ) { $ message .= "Exception: " . $ item -> message . "\n" ; if ( empty ( $ code ) && ! empty ( $ item -> code ) ) { $ code = $ item -> code ; } } return array ( $ message , $ code ) ; }
Helper function for store the error message and code from Fault returned from QuickBooks Online
Helper function for store the error message and code from Fault returned from QuickBooks Online