protected function _toData($errors)
    {
        $data = array();

        foreach ($errors as $error) {
            if ($error instanceof Exception) {
                $data[] = array('code' => $error->getCode(),'message' => $error->getMessage());
            } elseif ($error instanceof AnError) {
                $data[] = $error->toArray();
            }
        }

        return $data;
    }
protected function _toData($errors)
    {
        $data = array();

        foreach ($errors as $error) {
            if ($error instanceof Exception) {
                $data[] = array('code' => $error->getCode(),'message' => $error->getMessage());
            } elseif ($error instanceof AnError) {
                $data[] = $error->toArray();
            }
        }

        return $data;
    }
protected function _toData ( $ errors ) { $ data = array ( ) ; foreach ( $ errors as $ error ) { if ( $ error instanceof Exception ) { $ data [ ] = array ( 'code' => $ error -> getCode ( ) , 'message' => $ error -> getMessage ( ) ) ; } elseif ( $ error instanceof AnError ) { $ data [ ] = $ error -> toArray ( ) ; } } return $ data ; }
Converts an array of error into an array of serializable data.

@param array $error An array of errors

@return array
Converts an array of error into an array of serializable data .