code cleanup

The 1st commit can be considered to be a bugfix because the wrong variable was used there, at least with my understanding of the code.

The 2nd commit removes unused variables while trying not to break stuff, as the code seems to be pretty fragile. There's still a plenty of unused variables when calling methods in the manner of naming arguments like for `self::json_decode($value, $assoc = true)` where `$assoc` is in fact useless. I could remove them all as well.

The 3rd commit fixes the order of keywords in method signatures:
`static public|protected|private` &rarr; `public|protected|private static`.

Let me know what you think.