ZF2-357: Confusing usage of Interfaces "Color" and "ColorInterface" in \Zend\PDF

Issue Type: Improvement Created: 2012-06-13T14:31:07.000+0000 Last Updated: 2012-06-13T19:46:53.000+0000 Status: Resolved Fix version(s): Reporter: Hagen Hübel (itinance) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Pdf

Related issues: Attachments:


In \Zend\Pdf there are the following two Interfaces for Color-Objects: "\Zend\Pdf\Color" and "\Zend\Pdf\Color\ColorInterface" (both fully identically having the same methods containing the same signature).

Implementing Classes such as \Zend\Pdf\Color\RGB, \Zend\Pdf\Color\GrayScale, \Zend\Pdf\Color\HtmlColor and \Zend\Pdf\Color\CMYK only implements ColorInterface.

But some Methods as Style::setFillColor() or setLineColor() are asking for an Argument of Type "\Zend\Pdf\Color" instead of "\Zend\Pdf\Color\ColorInterface". So we can not use \Zend\Pdf\Color\RGB as Argument for Style::setFillColor(). The Page-Class requires ColorInterface, but Style requires Color (which has none implementations).

Either the Implementations of ColorInterface (RGB, GrayScale and so on) should implement also Color (not recommended IMHO), or Style and Font should require the same ArgumentType for Color-Arguments (ColorInterface instead of Color), otherwise it should be scrutinized wether or not \Zend\Pdf needs two separated Interfaces for the same task...


Posted by Maks 3w (maks3w) on 2012-06-13T19:46:53.000+0000

Hi Hagen,

Thank you for your observation. However Zend\Pdf will be rewritten and this will not be applied.


Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.