<commit_before><?php
namespace WFV\Artisan;
defined( 'ABSPATH' ) || die();

use WFV\Contract\ArtisanInterface;
use WFV\Collection\ErrorCollection;
use WFV\Collection\InputCollection;
use WFV\Collection\MessageCollection;
use WFV\Collection\RuleCollection;

use WFV\FormComposite;
use WFV\Validator;

/**
 *
 *
 * @since 0.10.0
 */
class FormArtisan implements ArtisanInterface {

	/**
	 *
	 *
	 * @since 0.10.0
	 * @var array
	 */
	public $collection = array();

	/**
	 *
	 *
	 * @since 0.11.0
	 * @var WFV\Validator
	 */
	public $validator;

	/**
	 *
	 *
	 * @since 0.10.0
	 * @access protected
	 * @var array
	 */
	protected $config = array();

	/**
	 *
	 *
	 * @since 0.10.0
	 * @access protected
	 * @var WFV\FormComposite
	 */
	protected $form;

	/**
	 *
	 *
	 * @since 0.11.0
	 *
	 * @param array $config
	 */
	public function __construct( array $config ) {
		$this->config = $config;
	}

	/**
	 * Return the final Form instance
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\FormComposite
	 */
	public function actualize() {
		return $this->form;
	}

	/**
	 * Creates the instance of FormComposite
	 *
	 * @since 0.10.0
	 *
	 * @param string $action
	 * @return WFV\Artisan\FormArtisan
	 */
	public function create( $action ) {
		$this->form = new FormComposite( $this, $action );
		return $this;
	}

	/**
	 * Create instance of ErrorCollection
	 * Save it in $collection array property
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function errors() {
		$this->collection['errors'] = new ErrorCollection( $this->labels() );
		return $this;
	}

	/**
	 * Create instance of InputCollection
	 * Save it in $collection array property
	 *
	 * @since 0.10.0
	 *
	 * @param array $data
	 * @return WFV\Artisan\FormArtisan
	 */
	public function input( array $data = [] ) {
		$input = $data[0];
		$trim = $data[1];
		$this->collection['input'] = new InputCollection( $input, $trim );
		return $this;
	}

	/**
	 *
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function messages() {
		$this->collection['messages'] = new MessageCollection( $this->config );
		return $this;
	}

	/**
	 * Create instance of RuleCollection
	 * Save it in $collection array property
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function rules() {
		foreach( $this->config as $field => $options ) {
			$rules[ $field ] = $options['rules'];
		}
		$this->collection['rules'] = new RuleCollection( $rules );
		return $this;
	}

	/**
	 * Create instance of WFV\Validator
	 * Save it in $validator property
	 *
	 * @since 0.11.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function validator() {
		$this->validator = new Validator();
		return $this;
	}
<commit_msg>FormBuilder - phpdoc fixes<commit_after><?php
namespace WFV\Artisan;
defined( 'ABSPATH' ) || die();

use WFV\Contract\ArtisanInterface;
use WFV\Collection\ErrorCollection;
use WFV\Collection\InputCollection;
use WFV\Collection\MessageCollection;
use WFV\Collection\RuleCollection;

use WFV\FormComposite;
use WFV\Validator;

/**
 *
 *
 * @since 0.10.0
 */
class FormArtisan implements ArtisanInterface {

	/**
	 *
	 *
	 * @since 0.10.0
	 * @var array
	 */
	public $collection = array();

	/**
	 *
	 *
	 * @since 0.11.0
	 * @var \WFV\Validator
	 */
	public $validator;

	/**
	 *
	 *
	 * @since 0.10.0
	 * @access protected
	 * @var array
	 */
	protected $config = array();

	/**
	 *
	 *
	 * @since 0.10.0
	 * @access protected
	 * @var \WFV\FormComposite
	 */
	protected $form;

	/**
	 *
	 *
	 * @since 0.11.0
	 *
	 * @param array $config
	 */
	public function __construct( array $config ) {
		$this->config = $config;
	}

	/**
	 * Return the final Form instance
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\FormComposite
	 */
	public function actualize() {
		return $this->form;
	}

	/**
	 * Creates the instance of FormComposite
	 *
	 * @since 0.10.0
	 *
	 * @param string $action
	 * @return WFV\Artisan\FormArtisan
	 */
	public function create( $action ) {
		$this->form = new FormComposite( $this, $action );
		return $this;
	}

	/**
	 * Create instance of ErrorCollection
	 * Save it in $collection array property
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function errors() {
		$this->collection['errors'] = new ErrorCollection( $this->labels() );
		return $this;
	}

	/**
	 * Create instance of InputCollection
	 * Save it in $collection array property
	 *
	 * @since 0.10.0
	 *
	 * @param array $data
	 * @return WFV\Artisan\FormArtisan
	 */
	public function input( array $data = [] ) {
		$input = $data[0];
		$trim = $data[1];
		$this->collection['input'] = new InputCollection( $input, $trim );
		return $this;
	}

	/**
	 *
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function messages() {
		$this->collection['messages'] = new MessageCollection( $this->config );
		return $this;
	}

	/**
	 * Create instance of RuleCollection
	 * Save it in $collection array property
	 *
	 * @since 0.10.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function rules() {
		$rules = array();
		foreach( $this->config as $field => $options ) {
			$rules[ $field ] = $options['rules'];
		}
		$this->collection['rules'] = new RuleCollection( $rules );
		return $this;
	}

	/**
	 * Create instance of WFV\Validator
	 * Save it in $validator property
	 *
	 * @since 0.11.0
	 *
	 * @return WFV\Artisan\FormArtisan
	 */
	public function validator() {
		$this->validator = new Validator();
		return $this;
	}

{'fraction_non_alphanumeric': 0.15704135543814904, 'fraction_numerical': 0.01967571506649663, 'mean_word_length': 2.893617021276596, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6584005', 'n_tokens_mistral': 2142, 'n_tokens_neox': 1844, 'n_words': 456}