GDToolkit::getResource()
checks GDToolkit::$resource
is a resource; if it's not, it calls GDToolkit::load()
, which first calls GDToolkit::isValid()
, which checks that either GDToolkit::$preloadInfo
or GDToolkit::$resource
has been set.
GDToolkit::load()
should not call GDToolkit::isValid()
. GDToolkit::load()
is a protected method called to initialize GDToolkit::$resource
; checking if GDToolkit::$resource
has been set and return FALSE
if it was not doesn't make sense. The method should check if GDToolkit::$preloadInfo
has been set, which means that GDToolkit::parseFile()
has returned TRUE
(i.e., the file whose filename is set with GDToolkit::setSource()
contains an image).
GDToolkit::isValid()
doesn't return FALSE simply because the Image
constructor calls GDToolkit::parseFile()
after calling GDToolkit::setSource()
; still checking the value of GDToolkit::$resource
twice doesn't make sense.