private function assertValid($object, int $code = 0)
    {
        $errors = $this->validator->validate($object);
        if (count($errors)) {
            throw ValidationException::becauseOfValidationErrors($errors, $code);
        }
    }
private function assertValid($object, int $code = 0)
    {
        $errors = $this->validator->validate($object);
        if (count($errors)) {
            throw ValidationException::becauseOfValidationErrors($errors, $code);
        }
    }
private function assertValid ( $ object , int $ code = 0 ) { $ errors = $ this -> validator -> validate ( $ object ) ; if ( count ( $ errors ) ) { throw ValidationException :: becauseOfValidationErrors ( $ errors , $ code ) ; } }
Assert that object is valid.

@param mixed $object
@param int $code

@throws ValidationException
Assert that object is valid .