public function check(array $insert, bool $throw = true): bool
    {
        foreach ($this->schema as $key => $rules) {
            // Check each key by given rules and respond
            // due to required flow.
            $result = $this->processRules($key, explode('|', $rules), $insert);

            if (!$result['status'] && $throw) {
                throw new InvalidArgumentException(
                    sprintf($result['message'], $key)
                );
            }
        }

        return $result['status'] ?? true;
    }
public function check(array $insert, bool $throw = true): bool
    {
        foreach ($this->schema as $key => $rules) {
            // Check each key by given rules and respond
            // due to required flow.
            $result = $this->processRules($key, explode('|', $rules), $insert);

            if (!$result['status'] && $throw) {
                throw new InvalidArgumentException(
                    sprintf($result['message'], $key)
                );
            }
        }

        return $result['status'] ?? true;
    }
public function check ( array $ insert , bool $ throw = true ) : bool { foreach ( $ this -> schema as $ key => $ rules ) { // Check each key by given rules and respond // due to required flow. $ result = $ this -> processRules ( $ key , explode ( '|' , $ rules ) , $ insert ) ; if ( ! $ result [ 'status' ] && $ throw ) { throw new InvalidArgumentException ( sprintf ( $ result [ 'message' ] , $ key ) ) ; } } return $ result [ 'status' ] ?? true ; }
Check if given array is matching the schema.

@param  array $insert
@param  bool  $throw

@return bool

@throws \InvalidArgumentException
Check if given array is matching the schema .