paquettg/leaguewrap — pull request #18 by michaelmoussa (2014-07-07 20:06:04+00:00)
Title: Updated Summoner "info" to support all-numeric summoner names

It is possible for a summoner's name to be made of of only numbers, e.g. `1337`

If `->info([1337])` is invoked with the intention of looking that summoner up by name, it will detect an ID and look based on the ID instead. This is because `FILTER_VALIDATE_INT` does not actually do a typecheck:

```
`$ php -r 'echo filter_var(1337, FILTER_VALIDATE_INT) === filter_var("1337", FILTER_VALIDATE_INT);'
1
```

The simplest way to fix this is to use `gettype(...)` instead of `FILTER_VALIDATE_INT`; however, that would introduce a backwards-compatibility break, and I don't know if you're allowing those at this time or not (even though it's technically a bug, IMO).

So, instead, I added an optional `$strict` parameter, which if true, indicates that it should check that the *type* is integer before deciding that it's an ID vs. a name. The default is false, so anybody currently using the library is unaffected.

**Note:** I had to change the `array_merge(...)` to the `+` operator instead, since PHP will reindex numeric arrays if you use `array_merge(...)`. Since numeric summoner names are, well, numeric, it will reindex the keys when merging and not be predictably accessible.

If you don't mind the BC break, let me know and I'll be happy to submit a different PR for the "more proper" fix. Just keep in mind that anybody currently using this library and looking summoners up by ID will have problems when they update, unless they were already typecasting IDs to integer.