gistpress icon indicating copy to clipboard operation
gistpress copied to clipboard

Split up main class

Open GaryJones opened this issue 10 years ago • 1 comments

The main class is getting too big and needs to be split up.

There are several groups of methods emerging. I'd like to see all of the processing and display of given HTML, split up from the URL determination and fetching / API calls, split up from the oembed stuff, and shortcode stuff. That is, we should be able to:

  • just have the shortcode, without the oembed support to turn it into a shortcode
  • formulate a URL and fetch results from it, but do nothing with it.
  • process some HTML, whatever the source (API results, transient, unit test string)

The process_gist_html() method, for instance, is 50+ lines long, and while it defers to process_gist_line_numbers() for another 30+ lines, both could be split up into ~4 methods each for code that is far easier to understand, and having a separate class would allow this.

GaryJones avatar Nov 01 '13 12:11 GaryJones

The cache should have an interface and be an object too - storing and retrieving, so that the implementation (the fact it's stored in transients, but it could equally have subclasses that stored it in flat files, for instance) is encapsulated.

GaryJones avatar Apr 18 '14 07:04 GaryJones