<commit_before># Traits

The various supplied `Tostring` traits are not documented since they're pretty
self-explanatory we think.

## `Attributes`

### `Attributes::attributes(void)`

Render a string of `name="value"` attributes based on the current element's
settings. Returns the rendered string.

### `Attributes::attribute(string $name, mixed $value)`

Set the attribute `$name` to `$value`. Use `false` to unset the attribute.

## `Element\Identify`

### `Element\Identify::prefix(string $prefix)`

Prefix the element name with a string. Useful when grouping elements, but mostly
should get called automatically.

### `Element\Identify::name(void)`

Returns the element's name.

### `Element\Identify::id(void)`

Returns the element's ID. This is essentially the name with illegal characters
replaced by hyphens, e.g. `my[element][name]` becomes `my-element-name`.

## `InputHelper`

### `InputHelper::populate(void)`

(Re)populate all elements in a form or group with the supplied data.

### `InputHelper::source(mixed $source)`

Set the source for this group of elements. Keys should match element names,
except for instances of `Formulaic\Radio\Group` where they don't matter.

You can pass a callable with will first get executed and should return a hash.

In rare cases (like a `Radio\Group`), `$source` should be a scalar, not an array
(since only one radio button in a group can be checked at the same time anyway).

## `QueryHelper`

### `QueryHelper::offsetGet(mixed $index)`

Attempt to get an element in the group that matches `$index`. Classes
implementing this trait allow accessing elements by name, e.g.

    <?php

    $form[] = new Text('foo');
    echo $form['foo'];

## `Validate\Required`

### `Validate\Required::isRequired(void)`

Marks the element as required.

## `Validate\Element`

### `Validate\Element::valid(void)`

Returns `true` if the element passes all its tests, `false` otherwise.

### `Validate\Element::errors(void)`

Returns an array of errors, or `null` if all tests passed.

## `Validate\Group`

### `Validate\Group::valid(void)`

Returns `true` if all elements in the group pass all tests, `false` otherwise.

### `Validate\Group::errors(void)`

Returns an array of errors, or `null` if all tests passed.

## `Validate\Test`

### `Validate\Test::addTest(string $name, callable $fn)`

Add the test `$fn` to the element under the name `$name`. The callback takes a
single argument (the element's current value) and should return `true` if the
test passed, `false` otherwise.<commit_msg>cleanup and remove inputhelper which was itself removed<commit_after># Traits

The various supplied `Tostring` traits are not documented since they're pretty
self-explanatory we think.

## `Attributes`

### `Attributes::attributes(void)`
Render a string of `name="value"` attributes based on the current element's
settings. Returns the rendered string.

### `Attributes::attribute(string $name, mixed $value)`
Set the attribute `$name` to `$value`. Use `false` to unset the attribute.

## `Element\Identify`

### `Element\Identify::prefix(string $prefix)`
Prefix the element name with a string. Useful when grouping elements, but mostly
should get called automatically.

### `Element\Identify::name(void)`
Returns the element's name.

### `Element\Identify::id(void)`
Returns the element's ID. This is essentially the name with illegal characters
replaced by hyphens, e.g. `my[element][name]` becomes `my-element-name`.

## `QueryHelper`

### `QueryHelper::offsetGet(mixed $index)`
Attempt to get an element in the group that matches `$index`. Classes
implementing this trait allow accessing elements by name, e.g.

```php
<?php

$form[] = new Text('foo');
echo $form['foo'];

```

## `Validate\Required`

### `Validate\Required::isRequired(void)`
Marks the element as required.

## `Validate\Element`

### `Validate\Element::valid(void)`
Returns `true` if the element passes all its tests, `false` otherwise.

### `Validate\Element::errors(void)`
Returns an array of errors, or `null` if all tests passed.

## `Validate\Group`

### `Validate\Group::valid(void)`
Returns `true` if all elements in the group pass all tests, `false` otherwise.

### `Validate\Group::errors(void)`
Returns an array of errors, or `null` if all tests passed.

## `Validate\Test`

### `Validate\Test::addTest(string $name, callable $fn)`
Add the test `$fn` to the element under the name `$name`. The callback takes a
single argument (the element's current value) and should return `true` if the
test passed, `false` otherwise.

{'fraction_non_alphanumeric': 0.12965821389195148, 'fraction_numerical': 0.0, 'mean_word_length': 5.154681139755767, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3260661', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1335, 'n_words': 530}