Project structure change

This commit is contained in:
Pablo Ferreiro 2022-01-31 00:02:52 +01:00
parent bd1642957c
commit 837f126021
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
29 changed files with 298 additions and 254 deletions

View file

@ -0,0 +1,14 @@
<?php
namespace App\Models;
/**
* Base for all templates, needs a Title to set
*/
class BaseTemplate {
public string $title;
public string $version;
function __construct(string $title) {
$this->title = $title;
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace App\Models;
/**
* Base for templates with a feed
*/
class FeedTemplate extends BaseTemplate {
public object $feed;
function __construct(string $title, object $feed) {
parent::__construct($title);
$this->feed = $feed;
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace App\Models;
/**
* Exclusive for /following
*/
class FollowingTemplate extends FeedTemplate {
public array $following;
function __construct(array $following, object $feed) {
parent::__construct('Following', $feed);
$this->following = $following;
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace App\Models;
/**
* Base for templates with item (only /video at the time)
*/
class ItemTemplate extends BaseTemplate {
public object $item;
function __construct(string $title, object $item) {
parent::__construct($title);
$this->item = $item;
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use App\Helpers\Cookies;
use App\Helpers\Following;
/**
* Exclusive for /settings
*/
class SettingsTemplate extends BaseTemplate {
public array $proxy_elements = [];
public array $following = [];
function __construct() {
parent::__construct('Settings');
$this->proxy_elements = Cookies::PROXY;
$this->following = Following::getUsers();
}
}