PHP Master, chapter 1 (OOP)
Actually, I submitted this as an error, but maybe I better would have posted it here. At least nobody started off with calling me a monkey :eek:
I have a problem with the Courier and Parcel classes on one of the first pages in chapter 1.
In the constructor method of the Courier class it says: return true;
Now I would expect to have a boolean returned instead of an object, but in practice that is not true. You can also return false or 'abacadabra', it does not matter, but it gives the wrong message to newbie OOPs.
My second problem is the Parcel class. It has setCountry and setWeight methods, that return $this.
Why? From my Java background, setters should reuturn void (or NULL in PHP terms) and getters whatever you want to get.
Actually, I think, since there is a setter, there should also be a getter, and the properties weight and destinationcountry should be made protected.
Last comment: the autoload function says: strtolower for the filenames, but in my code archive, the names of the files start with uppercase. On my Windows system I would not notice, but if I would upload this to my website, it would mysteriously go wrong.
After this I stopped reading this chapter. I liked the security chapter though!