Tidy up and CS fixes

- Renamed $_elements to $elements
- Added new line before return statements
- Returned early where possible
- Fixed usage of constant
- Removed duplicated code
- Removed unnecessary return statement in offsetSet
@vilartoni yes, PHP is simply incredibly slow at executing function calls, and since this API is widely used we should keep that impact minimal.

The duplication here is also small, so it is quite acceptable.