Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Development
[COSMIC] Project
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="LeChris" data-source="post: 455425" data-attributes="member: 37998"><p>The functionality of the classes using static functions looks limited to the App/ directory from what I can see.</p><p></p><p>Chances are he's doing it to prevent needing to constantly make a new instance of the class to do the same functionality, when you can just use a static function. They're being used as individual functions served under a collection pretty much.</p><p></p><p>I would argue that it doesn't have any impact on testing.</p><p><a href="https://github.com/devraizer/Asteroid/blob/master/AsteroidCMS/App/Auth.php" target="_blank">https://github.com/devraizer/Asteroid/blob/master/AsteroidCMS/App/Auth.php</a></p><p></p><p>You can easily assert that </p><ol> <li data-xf-list-type="ol">it finds a ban when it exists for the player</li> <li data-xf-list-type="ol">it will exit with a bad status code if ban exists</li> <li data-xf-list-type="ol">If staff it will store a log of the action</li> <li data-xf-list-type="ol">if ban does not exist it calls both Session and Player with the right data</li> </ol><p></p><p>If you want to move away from static functions everywhere, look into dependency injection which can construct a new instance of the injected dependency for you automatically. Unsure how good PHP DI is, but on TS you can get some pretty good results</p></blockquote><p></p>
[QUOTE="LeChris, post: 455425, member: 37998"] The functionality of the classes using static functions looks limited to the App/ directory from what I can see. Chances are he's doing it to prevent needing to constantly make a new instance of the class to do the same functionality, when you can just use a static function. They're being used as individual functions served under a collection pretty much. I would argue that it doesn't have any impact on testing. [URL]https://github.com/devraizer/Asteroid/blob/master/AsteroidCMS/App/Auth.php[/URL] You can easily assert that [LIST=1] [*]it finds a ban when it exists for the player [*]it will exit with a bad status code if ban exists [*]If staff it will store a log of the action [*]if ban does not exist it calls both Session and Player with the right data [/LIST] If you want to move away from static functions everywhere, look into dependency injection which can construct a new instance of the injected dependency for you automatically. Unsure how good PHP DI is, but on TS you can get some pretty good results [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Development
[COSMIC] Project
Top