ulsdevteam / lcsu

0 stars 0 forks source link

Use data elements (or named constants) instead of magic numbers #1

Closed ctgraham closed 5 years ago

ctgraham commented 5 years ago

https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/AppController.php#L87-L89

These permission levels ought to live in a data table within the database, or be define as constants within the PHP code.

Similarly with the Tray statuses: https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/TraysController.php#L30-L33

https://github.com/ulsdevteam/lcsu/blob/fd1e3dc5a1307831f0275fafc29c4aa746a60f90/src/Controller/TraysController.php#L317-L319

See: https://en.wikipedia.org/wiki/Magic_number_(programming)#Unnamed_numerical_constants

ctgraham commented 5 years ago

Resolved with the use of Configuration directives, e.g.: https://github.com/ulsdevteam/lcsu/commit/0be6eeaa0237496a2d7169c29d8f42c501f9215f#diff-84cdc096a9c19dd164392400be97da41R89

But, see: https://github.com/ulsdevteam/lcsu/issues/13#issuecomment-494124400