Minor refactoring, validate arguments for Element::offsetSet() added phpdoc annotations