<commit_before># [Rules v0.1](http://github.com/Miljar/rulesdsl)

## Introduction

Rules is a library to construct a set of rules in a more or less natural looking language.

The rules are flexible and can be extended at will. The goal is to be able to create a complex set of rules
to produce a single desired result.


## Usage

### Using PHP

```php
<?php
// Manually stitching things together (todo: implement ConditionChain)
$condition1 = new \Rules\Condition\Comparison\Equal(
    $bet->goals_home,
    $game->goals_home,
);
$condition2 = new \Rules\Condition\Comparison\Equal(
    $bet->goals_away,
    $game->goals_away,
);
$andCondition = new \Rules\Condition\Logical\LogicalAnd(
    $condition1,
    $condition2
);

$result = $andCondition->whenTrue(3)
    ->whenFalse(0)
    ->evaluate();

// $result == 3

// Using RulesBuilder (todo)
```

### Using DSL

_todo_

## Roadmap

1. Create base classes so the rules can be manually stitched together, and evaluated to produce a single result
2. Create a RulesBuilder to achieve the same result, but with a more fluent interface
3. Create a DSL on top of the existing code to allow a more natural looking programation
<commit_msg>Updated roadmap in the README<commit_after># [Rules v0.1](http://github.com/Miljar/rulesdsl)

## Introduction

Rules is a library to construct a set of rules in a more or less natural looking language.

The rules are flexible and can be extended at will. The goal is to be able to create a complex set of rules
to produce a single desired result.


## Usage

### Using PHP

```php
<?php
// Manually stitching things together (todo: implement ConditionChain)
$condition1 = new \Rules\Condition\Comparison\Equal(
    $bet->goals_home,
    $game->goals_home,
);
$condition2 = new \Rules\Condition\Comparison\Equal(
    $bet->goals_away,
    $game->goals_away,
);
$andCondition = new \Rules\Condition\Logical\LogicalAnd(
    $condition1,
    $condition2
);

$result = $andCondition->whenTrue(3)
    ->whenFalse(0)
    ->evaluate();

// $result == 3

// Using RulesBuilder (todo)
```

### Using DSL

_todo_

## Roadmap

1. Create base classes so the rules can be manually stitched together, and evaluated to produce a single result
1. Create ConditionChain class to chain together a bunch of conditions
1. Create a RulesBuilder to achieve the same result, but with a more fluent interface
1. Create a DSL on top of the existing code to allow a more natural looking programation

{'fraction_non_alphanumeric': 0.09719398129320862, 'fraction_numerical': 0.010166734444896299, 'mean_word_length': 3.910179640718563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6970487', 'n_tokens_mistral': 743, 'n_tokens_neox': 724, 'n_words': 299}