kazuhikoarase / qrcode-generator

QR Code Generator implementation in JavaScript, Java and more.
https://kazuhikoarase.github.io/qrcode-generator/js/demo/
MIT License
2.1k stars 677 forks source link

Move globals to class static variables #16

Closed aaroncampbell closed 8 years ago

aaroncampbell commented 8 years ago

The problem here is that if the qrcode.php file isn't included in the global scope (for example, if it's included inside a function), then the $QR_PATTERN_POSITION_TABLE, $QR_MAX_LENGTH, $QR_RS_BLOCK_TABLE, $QR_MATH_EXP_TABLE, and $QR_MATH_LOG_TABLE variables are not in the global scope either. So trying to access them using the global keyword doesn't work. There are two possible fixes. The first would be to actually globalize them before first using them, but they don't seem to need to be in the global scope so I don't see any reason to pollute that. The other is to actually bring them into the classes that use them and make them static properties of those classes. That's what I did here.

kazuhikoarase commented 8 years ago

Thanks a lot :)