The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Class Bloat
#1
Why is there a class for accessing one global variable? It's faster and simpler to just use:

Code:
$GLOBALS['config']['mysql']['username']

Similar case with Cookie, Hash, Input, Redirect, Session and Token. They could just be functions instead of static methods.
  Reply
#2
There is actually a little bit of a method to the madness.

While everyone here downloads userspice as one products, on the backend it is actually 3 products.

1. The open-source classes that were the standard classes constructed and taught by codeAcademy. People who took those courses, learned the classes this way so we learned them.

2. helpers.php are my functions that go in all of my projects, closed or open source.

3. us_helpers.php is mostly functions I only use on userspice or projects built on userspice.

So, because the classes came as a set, I left them as a set so the large number of people who learned coding from Alex had them as they were used to.

I also keep all these things in sync, so if we do update the db class, it gets updated across all my projects. Same for helpers.php.

Not the best answer, but there is a reason.
  Reply
#3
Function
Code:
sanitize()
is defined twice. In
Code:
helpers.php
and in
Code:
class Input
. I hope you won't ever have to modify it because if you change one and forget the other that could screw things up.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)