PHP Classes

it can be done with one method construct(allowedIPlist,curre...

Recommend this page to a friend!

      IP Restriction  >  All threads  >  it can be done with one method...  >  (Un) Subscribe thread alerts  
Subject:it can be done with one method...
Summary:Package rating comment
Messages:3
Author:adriano ghezzi
Date:2015-03-01 15:55:02
 

adriano ghezzi rated this package as follows:

Utility: Insufficient
Consistency: Not sure

  1. it can be done with one method...   Reply   Report abuse  
Picture of adriano ghezzi adriano ghezzi - 2015-03-01 15:55:02
it can be done with one method
construct(allowedIPlist,currentIP)
return T|F

it should have a method to get current IP from http request

  2. Re: it can be done with one method...   Reply   Report abuse  
Picture of Ovidiu Bokar Ovidiu Bokar - 2015-03-01 16:04:42 - In reply to message 1 from adriano ghezzi
You are right, all this can be done in one single method (not the constructor though), however, it is a bad practice to build everything in a single method, instead of having everything divided, if the code is organised any developer can extend the class and functionality faster without any hacks to the code.

  3. Re: it can be done with one method...   Reply   Report abuse  
Picture of adriano ghezzi adriano ghezzi - 2015-03-01 16:24:51 - In reply to message 2 from Ovidiu Bokar
opinions are opinions.

generally speaking I agree with you

but normally a function with a single functionality is just a function
PHP self has a lot of cunctions coded as function

don't overhead implementation when not needed.

I don't see anything that can be extended or further implementation

all private variables don't need to store any value.
code is just one call.