protected function encode(array $messages)
    {
        if ($this->encode) {
            foreach ($messages as $key => $message) {
                if (($form = mb_detect_encoding($message)) != self::TARGET_ENCODING) {
                    $messages[$key] = mb_convert_encoding($message, self::TARGET_ENCODING, $form);
                }
            }
        }

        return $messages;
    }
protected function encode(array $messages)
    {
        if ($this->encode) {
            foreach ($messages as $key => $message) {
                if (($form = mb_detect_encoding($message)) != self::TARGET_ENCODING) {
                    $messages[$key] = mb_convert_encoding($message, self::TARGET_ENCODING, $form);
                }
            }
        }

        return $messages;
    }
protected function encode ( array $ messages ) { if ( $ this -> encode ) { foreach ( $ messages as $ key => $ message ) { if ( ( $ form = mb_detect_encoding ( $ message ) ) != self :: TARGET_ENCODING ) { $ messages [ $ key ] = mb_convert_encoding ( $ message , self :: TARGET_ENCODING , $ form ) ; } } } return $ messages ; }
Encode messages.

@param array $messages

@return array
Encode messages .