StripeAPIChangeLogBridge.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * StripeAPIChangeLogBridge
  4. *
  5. * @name Stripe API Changelog Bridge
  6. * @description Returns the changes made to the stripe.com API
  7. */
  8. class StripeAPIChangeLogBridge extends BridgeAbstract{
  9. public function loadMetadatas() {
  10. $this->maintainer = 'Pierre Mazière';
  11. $this->name = 'Stripe API Changelog';
  12. $this->uri = '';
  13. $this->description = 'Returns the changes made to the stripe.com API';
  14. $this->update = '2016-06-20';
  15. }
  16. public function collectData(array $param){
  17. $html = file_get_html('https://stripe.com/docs/upgrades')
  18. or $this->returnError('No results for Stripe API Changelog', 404);
  19. foreach($html->find('h2') as $change){
  20. $item=new \Item();
  21. $item->title=trim($change->plaintext);
  22. $item->uri='https://stripe.com/docs/upgrades#'.$item->title;
  23. $item->name='stripe';
  24. $item->content=$change->nextSibling()->outertext;
  25. $item->timestamp=strtotime($item->title);
  26. $this->items[]=$item;
  27. }
  28. }
  29. public function getName(){
  30. return 'Stripe API Changelog';
  31. }
  32. public function getURI(){
  33. return 'https://stripe.com/docs/upgrades';
  34. }
  35. public function getCacheDuration(){
  36. return 86400; // one day
  37. }
  38. }