Move feed generation into generator classes and out of templates. Remove feed templates, since they don't have any UI elements. Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/36 Co-authored-by: Greg Sarjeant <greg@subcultureofone.org> Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
		
			
				
	
	
		
			24 lines
		
	
	
		
			772 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			772 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| // Abstract base class for feeds.
 | |
| // Specific feeds (RSS, Atom, etc.) will inherit from this.
 | |
| // This will wrap the basic generator functionality.
 | |
| abstract class FeedGenerator {
 | |
|     protected $config;
 | |
|     protected $ticks;
 | |
| 
 | |
|     public function __construct(ConfigModel $config, array $ticks) {
 | |
|         $this->config = $config;
 | |
|         $this->ticks = $ticks;
 | |
|     }
 | |
| 
 | |
|     abstract public function generate(): string;
 | |
|     abstract public function getContentType(): string;
 | |
| 
 | |
|     protected function buildTickUrl(int $tickId): string {
 | |
|         return Util::buildUrl($this->config->baseUrl, $this->config->basePath, "tick/{$tickId}");
 | |
|     }
 | |
| 
 | |
|     protected function getSiteUrl(): string {
 | |
|         return Util::buildUrl($this->config->baseUrl, $this->config->basePath);
 | |
|     }
 | |
| } |