original_string: public function hasAtLeast($field, $count, $message = null, $when = null)
      {
          $extra = array_filter(['on' => $when, 'message' => $message]);
  
          return $this->add($field, 'hasAtLeast', $extra + [
              'rule' => function ($value) use ($count) {
                  if (is_array($value) && isset($value['_ids'])) {
                      $value = $value['_ids'];
                  }
  
                  return Validation::numElements($value, Validation::COMPARE_GREATER_OR_EQUAL, $count);
              }
          ]);
      }
code: public function hasAtLeast($field, $count, $message = null, $when = null)
      {
          $extra = array_filter(['on' => $when, 'message' => $message]);
  
          return $this->add($field, 'hasAtLeast', $extra + [
              'rule' => function ($value) use ($count) {
                  if (is_array($value) && isset($value['_ids'])) {
                      $value = $value['_ids'];
                  }
  
                  return Validation::numElements($value, Validation::COMPARE_GREATER_OR_EQUAL, $count);
              }
          ]);
      }
code_tokens: public function hasAtLeast ( $ field , $ count , $ message = null , $ when = null ) { $ extra = array_filter ( [ 'on' => $ when , 'message' => $ message ] ) ; return $ this -> add ( $ field , 'hasAtLeast' , $ extra + [ 'rule' => function ( $ value ) use ( $ count ) { if ( is_array ( $ value ) && isset ( $ value [ '_ids' ] ) ) { $ value = $ value [ '_ids' ] ; } return Validation :: numElements ( $ value , Validation :: COMPARE_GREATER_OR_EQUAL , $ count ) ; } ] ) ; }
docstring: Add a validation rule to ensure that a field is an array containing at least
  the specified amount of elements
  
  @param string $field The field you want to apply the rule to.
  @param int $count The number of elements the array should at least have
  @param string|null $message The error message when the rule fails.
  @param string|callable|null $when Either 'create' or 'update' or a callable that returns
  true when the validation rule should be applied.
  @see \Cake\Validation\Validation::numElements()
  @return $this
docstring_tokens: Add a validation rule to ensure that a field is an array containing at least the specified amount of elements