original_string: protected function _checkPresence($field, $context)
      {
          $required = $field->isPresenceRequired();
  
          if (!is_string($required) && is_callable($required)) {
              return !$required($context);
          }
  
          $newRecord = $context['newRecord'];
          if (in_array($required, ['create', 'update'], true)) {
              return (
                  ($required === 'create' && !$newRecord) ||
                  ($required === 'update' && $newRecord)
              );
          }
  
          return !$required;
      }
code: protected function _checkPresence($field, $context)
      {
          $required = $field->isPresenceRequired();
  
          if (!is_string($required) && is_callable($required)) {
              return !$required($context);
          }
  
          $newRecord = $context['newRecord'];
          if (in_array($required, ['create', 'update'], true)) {
              return (
                  ($required === 'create' && !$newRecord) ||
                  ($required === 'update' && $newRecord)
              );
          }
  
          return !$required;
      }
code_tokens: protected function _checkPresence ( $ field , $ context ) { $ required = $ field -> isPresenceRequired ( ) ; if ( ! is_string ( $ required ) && is_callable ( $ required ) ) { return ! $ required ( $ context ) ; } $ newRecord = $ context [ 'newRecord' ] ; if ( in_array ( $ required , [ 'create' , 'update' ] , true ) ) { return ( ( $ required === 'create' && ! $ newRecord ) || ( $ required === 'update' && $ newRecord ) ) ; } return ! $ required ; }
docstring: Returns false if any validation for the passed rule set should be stopped
  due to the field missing in the data array
  
  @param \Cake\Validation\ValidationSet $field The set of rules for a field.
  @param array $context A key value list of data containing the validation context.
  @return bool
docstring_tokens: Returns false if any validation for the passed rule set should be stopped due to the field missing in the data array