PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » Spreadsheet_Excel_Writer » Bug #4665

Support for extended classes

Details

Request #4665Support for extended classes
Submitted2005-06-23 07:38 UTC
Fromdan at yes dot lt
StatusVerified
PackageSpreadsheet_Excel_Writer
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2005-06-23 07:38 UTC] dan at yes dot lt

Description:
------------
Now when extending Spreadsheet_Excel_Writer_Workbook class there is no way to return extended classes for *_Worksheet, *_Format, etc. from ->addWorksheet(), ->addFormat(), etc...

I sudgest to add additional parameter for those methods - $className:

< function &addWorksheet($name = '')
> function &addWorksheet($name = '', $className = '')

< function &addFormat($properties = array())
> function &addFormat($properties = array(), $className = '')

...

And then reimplement thouse methods to support different classes:

< $worksheet = new Spreadsheet_Excel_Writer_Worksheet(...

> if (! class_exists($className)) {
> $className = 'Spreadsheet_Excel_Writer_Worksheet';
> }
> $worksheet = new $className(...
> if (! is_a($worksheet, 'Spreadsheet_Excel_Writer_Worksheet')) {
> $this->raiseError('Custom class do not extends Spreadsheet_Excel_Writer_Worksheet', 0, PEAR_ERROR_DIE);
> }

...and the same for all other classes.