protected function getRule(string $name, string $key, array $parent_names = []): array
    {
        if (isset($this->rules[$key])) {
            return $this->rules[$key];
        }
        if ($this->total_rules === 1 || !$parent_names) {
            return $this->rules['*']; // Done here.
        }
        foreach (array_map('strtolower', $parent_names) as $_parent_key) {
            if (isset($this->rules[$_parent_key])) {
                return $this->rules[$_parent_key];
            }
        } // unset($_parent_key); // Housekeeping.

        return $this->rules['*'];
    }
protected function getRule(string $name, string $key, array $parent_names = []): array
    {
        if (isset($this->rules[$key])) {
            return $this->rules[$key];
        }
        if ($this->total_rules === 1 || !$parent_names) {
            return $this->rules['*']; // Done here.
        }
        foreach (array_map('strtolower', $parent_names) as $_parent_key) {
            if (isset($this->rules[$_parent_key])) {
                return $this->rules[$_parent_key];
            }
        } // unset($_parent_key); // Housekeeping.

        return $this->rules['*'];
    }
protected function getRule ( string $ name , string $ key , array $ parent_names = [ ] ) : array { if ( isset ( $ this -> rules [ $ key ] ) ) { return $ this -> rules [ $ key ] ; } if ( $ this -> total_rules === 1 || ! $ parent_names ) { return $ this -> rules [ '*' ] ; // Done here. } foreach ( array_map ( 'strtolower' , $ parent_names ) as $ _parent_key ) { if ( isset ( $ this -> rules [ $ _parent_key ] ) ) { return $ this -> rules [ $ _parent_key ] ; } } // unset($_parent_key); // Housekeeping. return $ this -> rules [ '*' ] ; }
Gets a specific rule.

@since 151115 Initial release.

@param string $name         Rule name.
@param string $key          Rule key.
@param array  $parent_names Parent names.

@return array An array of rule properties.
Gets a specific rule .