Re: One class, one file?

From: Date: Sat, 07 May 2005 09:59:18 +0000
Subject: Re: One class, one file?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-37529@lists.php.net to get a copy of this message
On 5/7/05, Christian Weiske <cweiske@cweiske.de> wrote: > Hello all, > > I was wondering if every class has to be in one file? > > My Net_Wifi package has one class which contains the functionality, and > two ones which are "object wrappers" to access the data returned from > the main class, e.g. > > class Net_Wifi { > function scan() { > $obj = new Net_Wifi_Data; > $obj->essid = "asd"; > $obj->rate = "11"; > return $obj; > } > } > > class Net_Wifi_Data { > var $essid = null; > var $rate = null; > } > > So Net_Wifi_Data is just a container class for simple data. > Would it be ok to not pack it into an own file but append it to > Net/Wifi.php? > In this case, since you're not using the OO at all I would suggest returning an assoc array instead. -- Justin Patrin

« previous php.pear.dev (#37529) next »