<?php

class X {
    private $regras = [
        "required"=>true, 
        "email"=>true
    ];
    
    public $filter = [
        'preco' => 'required;double(1,4)',
        'email' => 'required;email',
        'bilhetes' => 'required;min:0'
    ];
    
    public function bootFilterPost() {
    
        foreach ($this->filter as $key => $value):
            $arr = preg_split('/(;)/', $value);
            
            foreach ($arr as $a):

                if (array_key_exists ($a, $this->regras)):
                    $this->postRules[$key][$a] = $this->regras[$a];
                elseif (strpos($a, "(") !== false):
                    $split = explode("(", $a);
                    $this->postRules[$key][$split[0]] = "(" . $split[1]; 
                elseif (strpos($a, ":") !== false):
                    $split = explode(":", $a);
                    $this->postRules[$key][$split[0]] = $split[1]; 
                endif;
                
                
            endforeach;
        endforeach;
    
        var_dump($this->postRules);
    }
};




$x = new X;

$x->bootFilterPost();