3
votes
2answers
429 views

Should I put utility methods inside a class?

I have been working on a library which contains a large set of functions. For the sake of simplicity, I am going to use just one set as an example. I am not sure which is the better way, in terms of ...
4
votes
1answer
391 views

How to implement syntax sugar in OO

The Problem I regularly find myself writing the same code over and over again. For example if I want a value from a nested array structure I end up writing something like this: $config = ...
2
votes
3answers
1k views

OO PHP static keyword, should I use it?

I'm writing script for fb and I have 3 objects that I'll be using through all classes. I'm wondering if there is any advantage in using the static keyword except I don't have to create an instance ...
2
votes
3answers
481 views

Syntactic sugar in PHP with static functions

The dilemma I'm facing is: should I use static classes for the components of an application just to get nicer looking API? Example - the "normal" way: // example component class Cache{ abstract ...
-3
votes
2answers
897 views

Why don't inherited methods use child properties? (PHP)

I'm trying to get the code below to work in child classes. But it keeps failing because it is checking the basicDbClass rather than the child class. For those complaining and voting my question down ...
1
vote
3answers
275 views

Using static in PHP

I have a few functions in PHP that read data from functions in a class readUsername(int userId){ $reader = getReader(); return $reader->getname(userId); } readUserAddress(){ $reader = ...