Issues

ZF-14: Remove Zend_Pdf_Const

Issue Type: Improvement Created: 2006-06-16T23:42:01.000+0000 Last Updated: 2008-11-13T14:10:22.000+0000 Status: Resolved Fix version(s): - 0.1.4 (29/Jun/06)

  • 1.7.0 (17/Nov/08)

Reporter: Willie Alberty (willie) Assignee: Thomas Weidner (thomas) Tags: - Zend_Pdf

Related issues: - ZF-18

Attachments:

Description

Zend_Pdf_Const was initially conceived as the single home for all PDF-related constants. This worked well enough when the number of constants was small, but recent work (ZF-6 and Zend_Pdf_Image subclasses) has more than tripled the constant count, making a master class like this difficult to maintain.

None of the other components in the framework share this model; they all define constants in the base classes that use them. For consistency with the other components in the framework, and to improve maintainability going forward, move the constants currently defined in Zend_Pdf_Const to the base classes in which they are used.

Comments

Posted by Willie Alberty (willie) on 2006-06-16T23:43:16.000+0000

This issue necessitates a change to the public API. Specific details to follow...

Posted by Willie Alberty (willie) on 2006-06-17T14:33:53.000+0000

Done. This issue caused a backwards-incompatible API change. To repair your code, you will need to perform the following global search-and-replace operations:

<pre class="literal"> 
Zend_Pdf_Const::PAGESIZE_     ->  Zend_Pdf_Page::SIZE_
Zend_Pdf_Const::SHAPEDRAW_    ->  Zend_Pdf_Page::SHAPEDRAW_
Zend_Pdf_Const::FILLMETHOD_   ->  Zend_Pdf_Page::FILLMETHOD_
Zend_Pdf_Const::LINEDASHING_  ->  Zend_Pdf_Page::LINEDASHING_
Zend_Pdf_Const::PDF_          ->  Zend_Pdf::PDF_
Zend_Pdf_Const::pdfDate()     ->  Zend_Pdf::pdfDate()

In addition, font object creation has been revamped. Font objects are now instantiated via a factory methods. You will also need to perform the following global search-and-replace operation:

<pre class="literal"> 
new Zend_Pdf_Font_Standard(Zend_Pdf_Const::FONT_  ->
  Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_

Finally, the old static arrays $pageSizeAliases and $standardFonts have been completely removed. There are no replacements.

Posted by Willie Alberty (willie) on 2006-06-17T17:26:10.000+0000

On Jun 17, 2006, at 4:04 PM, andi@zend.com wrote:

I have one piece of feedback though. The constants (not sure if you are responsible for naming them or not) don't use underscores to separate words. I think it'd be much nicer to do so. I know we have it in the PHP coding standards, but not sure if we wrote it in the ZFW coding standards (if not we should).

Posted by Willie Alberty (willie) on 2006-06-17T19:11:10.000+0000

Implemented Andi's request. All constants in Zend_Pdf now have underscores between words.

{panel:title=NOTE: Due to this change, ignore the instructions above and use these instead.|titleBGColor=#F7D6C1|bgColor=#FFFFCE} To repair your code, you will need to perform the following global search-and-replace operations:

<pre class="literal">
Zend_Pdf_Const::PAGESIZE_                 -> Zend_Pdf_Page::SIZE_
Zend_Pdf_Const::SHAPEDRAW_FILLNSTROKE     -> Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE
Zend_Pdf_Const::SHAPEDRAW_                -> Zend_Pdf_Page::SHAPE_DRAW_
Zend_Pdf_Const::FILLMETHOD_NONZEROWINDING -> Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING
Zend_Pdf_Const::FILLMETHOD_EVENODD        -> Zend_Pdf_Page::FILL_METHOD_EVEN_ODD
Zend_Pdf_Const::LINEDASHING_              -> Zend_Pdf_Page::LINE_DASHING_
Zend_Pdf_Const::PDF_                      -> Zend_Pdf::PDF_
Zend_Pdf_Const::pdfDate()                 -> Zend_Pdf::pdfDate()

In addition, font object creation has been revamped. Font objects are now instantiated via a factory methods. You will also need to perform the following global search-and-replace operations:

<pre class="literal">
new Zend_Pdf_Font_Standard(Zend_Pdf_Const::FONT_  ->
  Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_

_BOLDITALIC  ->  _BOLD_ITALIC

Finally, the old static arrays $pageSizeAliases and $standardFonts have been completely removed. There are no replacements. {panel}

Posted by Willie Alberty (willie) on 2006-06-17T19:23:14.000+0000

Updated the coding standards document as well: http://framework.zend.com/wiki/display/…

Posted by Matthew Ratzloff (mratzloff) on 2008-05-24T21:05:10.000+0000

This change was made eons ago (in Zend Framework time) but the file Zend/Pdf/Const.php still exists. At this point it is safe to remove it entirely.

Posted by Thomas Weidner (thomas) on 2008-10-30T04:05:37.000+0000

Fixed with 12192

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:22.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts