azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.04k stars 152 forks source link

Add data point for holidays with link to holiday details #173

Closed crossan007 closed 4 years ago

crossan007 commented 5 years ago

It would be nice to have a curated list of links to URLs for details about the specified holiday.

stelgenhof commented 5 years ago

Hi @crossan007

Definitely a nice idea! Currently the source code contains links to URLs for the majority of the holidays. Are you thinking of a function for the Holiday class that returns those URL's? Or did you have something else in mind?

Cheers! Sacha

crossan007 commented 5 years ago

Exactly!

So, instead of the @ link comment (https://github.com/azuyalabs/yasumi/blob/develop/src/Yasumi/Provider/CommonHolidays.php#L36), the class Holiday could implement a getURLs() : array[] function which returns an array of type string (or possibly a new DTO for link - if we think more link metadata could be helpful).

This would enable applications using Yasumi to provide a user-facing link to view holiday details.

stelgenhof commented 5 years ago

I think each URL is rather a ValueObject than a DTO ;) Anyways, each Holiday could indeed return a collection of URL's that are defined within the class. As for any metadata, do you have some ideas/suggestions for that? What I can think of right now is the 'source', however that can possible be deduced from the URL.

So we could have:

crossan007 commented 5 years ago

An additional (possibly useful) property of the 'source' object may be an ENUM value representing the "authoritativeness" (or a better word) of the 'source'. I.E. COMMUNITY_MAINTAINED, vs GOVERNMENT_OFFICIAL to allow data-class-consumers to differentiate "wikipedia-like" sites from "official" sites.

There are probably other "information authority classifications" that would fit here, but I can't seem to think of any ;-)

Also - instead of source, HolidayInformationalReference may be a good name for the ValueObject.

stelgenhof commented 5 years ago

That is indeed a valuable property. Other ones could also be:

My only concern at the moment is that it would become a pretty heavy ValueObject :) Perhaps it is best to start simple.

crossan007 commented 5 years ago

Of those you listed, I think Date of Last Revision would be the simplest to include with the highest benefit.

Would Author be person / organization / government credited with creating the content at the URL? Or the person who contributed the HolidayInformationalReference data?

Not sure how we can "objectively" quantify Objectivity and Accuracy :-) but I like the idea!

stelgenhof commented 5 years ago

Author would be indeed the person / organization / government that is the owner of the source. Perhaps this one is of low benefit.

Indeed Objectivity and Accuracy might be hard to quantify and even testify as it can be quite subjective. It was just a thought :)

stelgenhof commented 5 years ago

I have some good idea how to do this :) At the moment I am working on making the Yasumi v2.2 release, so I will have a go after that.

github-actions[bot] commented 4 years ago

This issue has been open 30 days with no activity. Please remove the stale label or comment, or this will be closed in 5 days