Get field message for given field in given array.

@param string $sFieldName
@param array  $aFieldMessages

@return string
510033
protected function GetMessageForField($sFieldName, $aFieldMessages)
    {
        $sMessage = '';
        if (is_array($aFieldMessages) && isset($aFieldMessages[$sFieldName])) {
            $sMessage = $aFieldMessages[$sFieldName];
        }

        return $sMessage;
    }
555629
public function getMessage() : ?string 
    {
        if ( ! $this->hasMessage()) {
            $this->setMessage($this->getDefaultMessage());
        }
        return $this->message;
    }
258062
def _GetFieldByName(message_descriptor, field_name):
  
  try:
    return message_descriptor.fields_by_name[field_name]
  except KeyError:
    raise ValueError('Protocol message %s has no "%s" field.' %
                     (message_descriptor.name, field_name))
617024
protected String getMessage(String contextId, String fieldPath, String[] faceDescriptorProperties,
            String defaultValue) {
        String[] keys = getMessageKeys(contextId, fieldPath, faceDescriptorProperties);
        try {
            return getMessageSourceAccessor().getMessage(new DefaultMessageSourceResolvable(keys, null, defaultValue));
        } catch (NoSuchMessageException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage());
            }
            return null;
        }
    }
68201
protected function flattenSubMessages(
        string $fieldName,
        array $subMessages,
        array $messages
    ): array {
        foreach ($subMessages as $subFieldName => $subFieldMessages) {
            $fieldNamePath = $this->buildFieldName($fieldName, $subFieldName);

            $messages[$fieldNamePath] = $subFieldMessages;
        }

        return $messages;
    }
1351140
public function getSwiftMessage()
    {
        $message = \Swift_Message::newInstance();

        if (true === is_array($this->getRecipient())) {
            $recipient = $this->getRecipient();
        } else {
            $recipient = [
                $this->getRecipient(),
            ];
        };

        $message
            ->setSubject($this->getSubject())
            ->setFrom(
                [
                    $this->getSender(),
                ]
            )
            ->setTo($recipient)
            ->setBody($this->getMessage());

        if (0 < count($this->getAttachments())) {
            foreach ($this->getAttachments() as $attachment) {
                $message->attach($attachment);
            }
        }

        return $message;
    }
981770
public function buildMessages(
        string $fieldName,
        ValidationResult $validationResult,
        array $messages = [],
        array $options = []
    ): array {
        if ($validationResult instanceof ValidationResultFields) {
            $options[Field::KEY_FIELD_NAME] = $fieldName;
            $subMessages = $this->buildMessagesValidationFields(
                $validationResult->getFieldResults(),
                [],
                $options
            );

            $messages = $this->flattenSubMessages(
                $fieldName,
                $subMessages,
                $messages
            );

            return $messages;
        }

        $options[Field::KEY_FIELD_NAME] = $fieldName;
        $messages[$fieldName] = $this->getMessagesValidationResult->__invoke(
            $validationResult,
            $options
        );

        return $messages;
    }
237665
function _getMessageFilesArray() {
        $props = array(
            'name' => $this->filename
        );
        
        $file = @\realpath($this->attachment);
        if($file) {
            $props['path'] = $file;
        } elseif(\filter_var($this->attachment, \FILTER_VALIDATE_URL)) {
            $props['path'] = $this->attachment;
        } else {
            $props['data'] = $this->attachment;
        }
        
        if(empty($props['name'])) {
            if(!empty($props['path'])) {
                $props['name'] = \basename($props['path']);
            } else {
                $props['name'] = 'file-'.\bin2hex(\random_bytes(3)).'.jpg';
            }
        }
        
        return $props;
    }
155152
private ISFSObject getMessage() {
        if(messageObject != null) {
            MessageParamsClass clazz = context.getMessageParamsClass(messageObject.getClass());
            if(clazz != null) 
                return new ResponseParamSerializer().object2params(clazz.getUnwrapper(), messageObject);
        }
        if(jsonMessage != null)
            return SFSObject.newFromJsonData(jsonMessage);
        if(messageString == null)
            return new SFSObject();
        ISFSObject answer = new SFSObject();
        answer.putUtfString(APIKey.MESSAGE, messageString);
        return answer;
            
    }
120975
public function getFlashMessengerMessages() 
    {
        $this->fmContainer = new Container('fms');
        $flashMessages = $this->fmContainer->flashMessages;
        
        if(!empty($flashMessages))
        {
            $flashMessages = array_reverse($flashMessages);
        }
        
        return Json::encode($flashMessages);
    }
927562
def _IncludeFields(encoded_message, message, include_fields):
    """"""
    if include_fields is None:
        return encoded_message
    result = json.loads(encoded_message)
    for field_name in include_fields:
        try:
            value = _GetField(message, field_name.split('.'))
            nullvalue = None
            if isinstance(value, list):
                nullvalue = []
        except KeyError:
            raise exceptions.InvalidDataError(
                'No field named %s in message of type %s' % (
                    field_name, type(message)))
        _SetField(result, field_name.split('.'), nullvalue)
    return json.dumps(result)
404359
protected function _debugExpectedFields($expectedFields = [], $missingMessage = '')
    {
        if (count($expectedFields) === 0) {
            return null;
        }

        $expectedFieldNames = [];
        foreach ((array)$expectedFields as $key => $expectedField) {
            if (is_int($key)) {
                $expectedFieldNames[] = $expectedField;
            } else {
                $expectedFieldNames[] = $key;
            }
        }

        return sprintf($missingMessage, implode(', ', $expectedFieldNames));
    }
368633
private function getMessage(string $message): string
    {
        $hasTranslation = $this->messages !== null && array_key_exists($message, $this->messages) === false;

        return $hasTranslation === true ? $this->messages[$message] : $message;
    }
818677
public function getMessages($field = null)
    {
        $context = $this->_context;

        if ($field) {
            return isset($context->messages[$field]) ? $context->messages[$field] : [];
        } else {
            return $context->messages;
        }
    }
204986
public function error_messages(){
        $messages= array();
        foreach ($this->fieldsState as $fieldState) {
            //Si no es valido agrego el mensaje de error
            if(! $fieldState['valid']){
                $name= $fieldState['name'];
                $messages["$name"]= $fieldState['message'];
            }
        }
        return $messages;
    }
702033
public function getNotEmptyMessage($field)
    {
        if (!isset($this->_fields[$field])) {
            return null;
        }

        $defaultMessage = 'This field cannot be left empty';
        if ($this->_useI18n) {
            $defaultMessage = __d('cake', 'This field cannot be left empty');
        }

        $notBlankMessage = null;
        foreach ($this->_fields[$field] as $rule) {
            if ($rule->get('rule') === 'notBlank' && $rule->get('message')) {
                return $rule->get('message');
            }
        }

        return isset($this->_allowEmptyMessages[$field])
            ? $this->_allowEmptyMessages[$field]
            : $defaultMessage;
    }
953290
def get_field_description(f):
    """"""
    type_name = get_field_type(f)
    if type_name == 'MESSAGE' and \
            {sf.name for sf in f.message_type.fields} == {'key', 'value'}:
        return 'map<string, string>'
    elif type_name == 'MESSAGE':
        return f.message_type.full_name
    elif type_name == 'ENUM':
        return f.enum_type.full_name
    else:
        return type_name.lower()