yohang/CalendR — pull request #27 by adrx (2013-07-24 13:31:36+00:00)
Title: allow use of alternate Factory that implements FactoryInterface.

This PR modifies the present alternate-periods branch to allow use of alternate Factory that implements a new FactoryInterface, rather than having to extend CalendR\Period\Factory as it would with the current. It also moves the alternate period creation logic used by Calendar.php back to Calendar.php from Period/Factory.php, to slify the Factory Interface. FactoryTest is modified to reflect these changes.

I have not changed the phpdoc "@return" statements in Factory and elsewhere that assume that FactoryInterface methods return objects that extend CalendR\Period\ objects. I note that the AlternatePeriodsTest only verifies that the code will handle alternate period objects that extend those objects.

It might be useful to permit alternate period objects that implement PeriodInterface (or, better, an Interface specific to Year, Month, Week, Day and Range objects) without having to extend the existing objects.

If AlternatePeriodsTest reflects what you consider to be the required behavior of any Year, Month, Week, Day or Range object, then I could work out the interfaces from that.