class Maker (View source)

internal  
 

Generates rule constraints classes and markdown table by extracting rules from Validation::class metadata.

This class is not meant to be used directly and is not part of the public API.

Methods

static string
buildConstantsClass(array $variables)

No description

static string
buildConstraintClass(array $variables)

No description

static void
clearConstraintsDirectory(string $directory)

No description

static object
extractMetadataFromDocBlockMethod(string $method)

No description

static string
getFileDocBlock()

No description

static array
static string
makeConstants(string|null $namespacePrefix = null, string|null $className = null)

Makes rules names as constants.

static array
makeConstraints(string|null $namespacePrefix = null, string|null $classNameSuffix = null, bool $alwaysAddSuffix = false)

Make rule constraints classes.

static string
makeRulesMarkdownTable(string|null $classNameSuffix = null, bool $alwaysAddSuffix = false)

Makes rules markdown table.

Details

static private string buildConstantsClass(array $variables)

No description

Parameters

array $variables

Return Value

string

static private string buildConstraintClass(array $variables)

No description

Parameters

array $variables

Return Value

string

static private void clearConstraintsDirectory(string $directory)

No description

Parameters

string $directory

Return Value

void

static private object extractMetadataFromDocBlockMethod(string $method)

No description

Parameters

string $method

Return Value

object

static private string getFileDocBlock()

No description

Return Value

string

static private array getValidationClassDocBlockMethods()

No description

Return Value

array

static string makeConstants(string|null $namespacePrefix = null, string|null $className = null)

Makes rules names as constants.

Parameters

string|null $namespacePrefix

[optional] Class namespace prefix (defaults to Rule class short name).

string|null $className

[optional] Class name (defaults to Validation class short name).

Return Value

string

The path to the generated class.

static array makeConstraints(string|null $namespacePrefix = null, string|null $classNameSuffix = null, bool $alwaysAddSuffix = false)

Make rule constraints classes.

Parameters

string|null $namespacePrefix

[optional] Constraints namespace prefix (defaults to Rule constraint class short name).

string|null $classNameSuffix

[optional] Constraints class name suffix (defaults to Constraint class short name).

bool $alwaysAddSuffix

[optional] Whether or not to always add class name suffix or only when needed (when it is a reserved word).

Return Value

array

An array of paths to the generated classes.

static string makeRulesMarkdownTable(string|null $classNameSuffix = null, bool $alwaysAddSuffix = false)

Makes rules markdown table.

Parameters

string|null $classNameSuffix

[optional] Constraints class name suffix (defaults to Constraint class short name).

bool $alwaysAddSuffix

[optional] Whether or not to always add class name suffix or only when needed (when it is a reserved word).

Return Value

string

The markdown code.