Skip to end of metadata
Go to start of metadata

Zend Framework: Zend_Filter_StringToCapitalize Component Proposal

Proposed Component Name Zend_Filter_StringToCapitalize
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Filter_StringToCapitalize
Proposers Thomas Weidner
Zend Liaison TBD
Revision 1.0 - 12 April 2010: Initial Draft. (wiki revision: 2)

Table of Contents

1. Overview

Zend_Filter_StringToCapitalize is a simple string filter which lowercases the string and capitalizes each word.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will capitalize strings by lowercasing them and uppercasing the first character of each word
  • This component will only work on strings

4. Dependencies on Other Framework Components

  • Zend_Filter

5. Theory of Operation

The component is a string filter and can be used like all other filters.

6. Milestones / Tasks

  • Milestone 1: [DONE] Proposal finished
  • Milestone 2: Proposal accepted
  • Milestone 3: Working implementation
  • Milestone 4: Unit tests
  • Milestone 5: Documentation
  • Milestone 6: Moved to core

7. Class Index

  • Zend_Filter_StringToCapitalize

8. Use Cases

UC-01

Default usage

INPUT : "my input"
OUTPUT: "My Input"

UC-02

Encoding

INPUT : "my ärger"
OUTPUT: "My Ärger"

UC-03

Only first word

INPUT : "my ärger"
OUTPUT: "My ärger"

9. Class Skeletons

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Apr 12, 2010

    One thing to mention:
    Do we want to have the several casing variants diverted into seperate filters, or is it convinient to have one filter for all variants.

    get my content - lower (already done by StringToLower)
    GET MY CONTENT - upper (already done by StringToUpper)
    Get My Content - word
    Get my content - first

    1. Jul 28, 2010

      I'd personally prefer to have this in one filter.

      Also, why can't this class accept arrays as well?

      1. Jul 30, 2010

        All string filters should behave the same way.
        It would be no good if this single string filter behaves different than all other string filters.

        When there is a good usecase for string filters to support arrays in addition to strings then all filters should support it.

  2. Apr 13, 2010

    In 2. it's mb_convert_case instead of mb_case_convert.

  3. Aug 03, 2010

    Community Review Team Recommendation

    The CR Team advises that this proposal be approved, and suggests this component then also implements the (de)capitalization of entire strings, preparing for a possible removing of StringToUpper and StringToLower in ZF2. Also we suggest to reconsider the name, e.g. Zend_Filter_StringCase.

    1. Aug 03, 2010

      Note:
      I was said from my Zend liaison that functionallity has to be divided into several proposals.
      This would also be true for ToLower/ToUpper. I have no problem to concate them into a single filter when it's really wished to do so.

      Note2:
      For ZF 2.0 it would be better to move all explicit "string" Filters to the namespace
      "Zend_Filter_String_"... therefor my proposed name would be "Zend_Filter_String_Case"

      1. Aug 12, 2010

        While your liaison may have recommended this in the past, the CR Team has a good argument, and my team and I agree with what they recommend. It will mean a little overlap of functionality in ZF1, but the StringToUpper and StringToLower filters can then be removed in ZF2.

        As for reorganization of the filter namespace, that debate has moved to the zf-contributors mailing list.