Last modified 3 years ago
Refactoring
Introduce MogileFsResource object
Currently, MogileFs::get() returns an ugly array. This should be refactored to return an collection of MogileFsResource objects.
Naming
- The name for PHP versions >=5.3 will be MogileFs\Resource
The signature
- MogileFsResource::__construct(string name, string uri, string domain): Constructor for easier testing
- MogileFsResource::getName(): returns the name of the resource as a string
- MogileFsResource::getDomain(): returns the name of the domain as a string
- MogileFsResource::getUri(): returns the URI of the resource (e.g. http://tracker/dev1/000/0000/12.fid)
- MogileFsResource::fetch(): returns the content of the resource as a string. Uses getUri() internally.
- MogileFsResource::save(string filename): Write the content of the resource to file filename. Uses getUri() internally.
Introduce MogileFsResourceCollection object
The resource collection object contains a number of of objects of the type MogileFsResource
Naming
- The name for PHP versions >=5.3 will be MogileFs\ResourceCollection
Details
- The resource collection object implements the interface countable to return the number of containing objects
- The resource collection implements the Iterator interface
- The resource collection has a method getRandomResource() to randomly return a resource object
Add setter/getter for the resource object and resource collection class
We introduce two mutator pairs: set/getResourceCollectionClass() and set/getResourceClass()
Details
- Both of the setters take one argument, the name of the resource / resource collection class
