protected function filterArray($rules, $rawAttributes)
    {
        $attributes = [];
        foreach (array_keys($rules) as $filedName) {
            $value = array_get($rawAttributes, $filedName, 'not found in array'); // Default value !== null
            if ($value !== 'not found in array') { // Only if field specified in incoming array
                if (isset($this->filters[$filedName])) {
                    $filters = explode('|', $this->filters[$filedName]);
                    foreach ($filters as $filter) {
                        array_set($attributes, $filedName, $this->$filter($value));
                    }
                } else {
                    array_set($attributes, $filedName, $value);
                }
            }
        }
        return $attributes;
    }
protected function filterArray($rules, $rawAttributes)
    {
        $attributes = [];
        foreach (array_keys($rules) as $filedName) {
            $value = array_get($rawAttributes, $filedName, 'not found in array'); // Default value !== null
            if ($value !== 'not found in array') { // Only if field specified in incoming array
                if (isset($this->filters[$filedName])) {
                    $filters = explode('|', $this->filters[$filedName]);
                    foreach ($filters as $filter) {
                        array_set($attributes, $filedName, $this->$filter($value));
                    }
                } else {
                    array_set($attributes, $filedName, $value);
                }
            }
        }
        return $attributes;
    }
protected function filterArray ( $ rules , $ rawAttributes ) { $ attributes = [ ] ; foreach ( array_keys ( $ rules ) as $ filedName ) { $ value = array_get ( $ rawAttributes , $ filedName , 'not found in array' ) ; // Default value !== null if ( $ value !== 'not found in array' ) { // Only if field specified in incoming array if ( isset ( $ this -> filters [ $ filedName ] ) ) { $ filters = explode ( '|' , $ this -> filters [ $ filedName ] ) ; foreach ( $ filters as $ filter ) { array_set ( $ attributes , $ filedName , $ this -> $ filter ( $ value ) ) ; } } else { array_set ( $ attributes , $ filedName , $ value ) ; } } } return $ attributes ; }
Filter array with data to validate

@param array $rules         Rules array
@param array $rawAttributes Array with data passed to validation

@return array
Filter array with data to validate