Skip to content

Instantly share code, notes, and snippets.

View Lschulzes's full-sized avatar

Lucas Schulze Lschulzes

  • PatientStudio
  • Brazil
View GitHub Profile
<?php
class Rules {
// Sets all of the rules to check a given field
public $ruleParameters = ['isRequired', 'maxLenght', 'minLength', 'atLeastOne'];
// Creates all of the specific parameters for the rules
public function __construct($parameters){
foreach($parameters as $parameter => $value) $this->ruleParameters[$parameter] = $value;
}
// Checks if a string follows all of the parameters
public function checkRules($string) {