[mod] rename to "davina"

This commit is contained in:
fenris 2025-09-16 12:05:35 +02:00
parent 19cce2c90d
commit 40361269e5
18 changed files with 106 additions and 106 deletions

View file

@ -1,4 +1,4 @@
# davigil # davina
## Beschreibung ## Beschreibung

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil; namespace davina;
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\conf; namespace davina\conf;
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\helpers\cache; namespace davina\helpers\cache;
/** /**
@ -267,7 +267,7 @@ class class_cache_apcu
{ {
$options = \array_merge( $options = \array_merge(
[ [
'prefix' => 'davigil_', 'prefix' => 'davina_',
], ],
($options ?? []) ($options ?? [])
); );

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\helpers\call; namespace davina\helpers\call;
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\helpers\ics; namespace davina\helpers\ics;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
require_once('helpers/string.php'); require_once('helpers/string.php');
@ -520,7 +520,7 @@ function date_encode(
struct_date $date struct_date $date
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
'{{year}}{{month}}{{day}}', '{{year}}{{month}}{{day}}',
[ [
'year' => \str_pad(\sprintf('%u', $date->year), 4, '0', \STR_PAD_LEFT), 'year' => \str_pad(\sprintf('%u', $date->year), 4, '0', \STR_PAD_LEFT),
@ -537,7 +537,7 @@ function time_encode(
struct_time $time struct_time $time
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
'{{hour}}{{minute}}{{second}}{{utc}}', '{{hour}}{{minute}}{{second}}{{utc}}',
[ [
'hour' => \str_pad(\sprintf('%u', $time->hour), 2, '0', \STR_PAD_LEFT), 'hour' => \str_pad(\sprintf('%u', $time->hour), 2, '0', \STR_PAD_LEFT),
@ -555,7 +555,7 @@ function datetime_encode(
struct_datetime $datetime struct_datetime $datetime
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
'{{date}}T{{time}}', '{{date}}T{{time}}',
[ [
'date' => date_encode($datetime->date), 'date' => date_encode($datetime->date),
@ -574,9 +574,9 @@ function vcalendar_encode(
{ {
$content_lines = []; $content_lines = [];
\array_push($content_lines, 'BEGIN:VCALENDAR'); \array_push($content_lines, 'BEGIN:VCALENDAR');
\array_push($content_lines, \davigil\helpers\string_\coin('VERSION:{{version}}', ['version' => $vcalendar->version])); \array_push($content_lines, \davina\helpers\string_\coin('VERSION:{{version}}', ['version' => $vcalendar->version]));
\array_push($content_lines, \davigil\helpers\string_\coin('PRODID:{{prodid}}', ['prodid' => $vcalendar->prodid])); \array_push($content_lines, \davina\helpers\string_\coin('PRODID:{{prodid}}', ['prodid' => $vcalendar->prodid]));
\array_push($content_lines, \davigil\helpers\string_\coin('METHOD:{{method}}', ['method' => $vcalendar->method])); \array_push($content_lines, \davina\helpers\string_\coin('METHOD:{{method}}', ['method' => $vcalendar->method]));
foreach ($vcalendar->events as $vevent) foreach ($vcalendar->events as $vevent)
{ {
\array_push($content_lines, 'BEGIN:VEVENT'); \array_push($content_lines, 'BEGIN:VEVENT');
@ -584,7 +584,7 @@ function vcalendar_encode(
// uid // uid
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'UID:{{uid}}', 'UID:{{uid}}',
[ [
'uid' => $vevent->uid, 'uid' => $vevent->uid,
@ -595,7 +595,7 @@ function vcalendar_encode(
// dtstart // dtstart
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'DTSTART:{{dtstart}}', 'DTSTART:{{dtstart}}',
[ [
'dtstart' => datetime_encode($vevent->dtstart->value), 'dtstart' => datetime_encode($vevent->dtstart->value),
@ -608,7 +608,7 @@ function vcalendar_encode(
{ {
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'DTEND:{{dtend}}', 'DTEND:{{dtend}}',
[ [
'dtend' => datetime_encode($vevent->dtend->value), 'dtend' => datetime_encode($vevent->dtend->value),
@ -620,7 +620,7 @@ function vcalendar_encode(
// dtstamp // dtstamp
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'DTSTAMP:{{dtstamp}}', 'DTSTAMP:{{dtstamp}}',
[ [
'dtstamp' => datetime_encode($vevent->dtstamp), 'dtstamp' => datetime_encode($vevent->dtstamp),
@ -633,7 +633,7 @@ function vcalendar_encode(
{ {
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'CLASS:{{class}}', 'CLASS:{{class}}',
[ [
'class' => class_encode($vevent->class), 'class' => class_encode($vevent->class),
@ -645,7 +645,7 @@ function vcalendar_encode(
// summary // summary
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'SUMMARY:{{summary}}', 'SUMMARY:{{summary}}',
[ [
'summary' => $vevent->summary, 'summary' => $vevent->summary,
@ -658,7 +658,7 @@ function vcalendar_encode(
{ {
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'DESCRIPTION:{{description}}', 'DESCRIPTION:{{description}}',
[ [
'description' => $vevent->description, 'description' => $vevent->description,
@ -672,7 +672,7 @@ function vcalendar_encode(
{ {
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'LOCATION:{{location}}', 'LOCATION:{{location}}',
[ [
'location' => $vevent->location, 'location' => $vevent->location,
@ -719,7 +719,7 @@ function vcalendar_encode(
{ {
\array_push( \array_push(
$content_lines, $content_lines,
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'CATEGORIES:{{categories}}', 'CATEGORIES:{{categories}}',
[ [
'categories' => \implode(',', $vevent->categories), 'categories' => \implode(',', $vevent->categories),
@ -735,7 +735,7 @@ function vcalendar_encode(
$lines = []; $lines = [];
foreach ($content_lines as $content_line) foreach ($content_lines as $content_line)
{ {
$slices = \davigil\helpers\string_\slice($content_line, 75 - 1); $slices = \davina\helpers\string_\slice($content_line, 75 - 1);
\array_push($lines, $slices[0]); \array_push($lines, $slices[0]);
foreach (\array_slice($slices, 1) as $slice) foreach (\array_slice($slices, 1) as $slice)
{ {
@ -753,11 +753,11 @@ function datetime_to_unix_timestamp(
struct_datetime $datetime struct_datetime $datetime
) : int ) : int
{ {
return \davigil\helpers\pit\pit_to_unix_timestamp( return \davina\helpers\pit\pit_to_unix_timestamp(
\davigil\helpers\pit\pit_from_datetime( \davina\helpers\pit\pit_from_datetime(
new \davigil\helpers\pit\struct_datetime( new \davina\helpers\pit\struct_datetime(
0, 0,
new \davigil\helpers\pit\struct_date( new \davina\helpers\pit\struct_date(
$datetime->date->year, $datetime->date->year,
$datetime->date->month, $datetime->date->month,
$datetime->date->day $datetime->date->day
@ -767,7 +767,7 @@ function datetime_to_unix_timestamp(
? ?
null null
: :
new \davigil\helpers\pit\struct_time( new \davina\helpers\pit\struct_time(
$datetime->time->hour, $datetime->time->hour,
$datetime->time->minute, $datetime->time->minute,
$datetime->time->second $datetime->time->second
@ -785,8 +785,8 @@ function datetime_from_unix_timestamp(
int $unix_timestamp int $unix_timestamp
) : struct_datetime ) : struct_datetime
{ {
$pit = \davigil\helpers\pit\pit_from_unix_timestamp($unix_timestamp); $pit = \davina\helpers\pit\pit_from_unix_timestamp($unix_timestamp);
$datetime = \davigil\helpers\pit\pit_to_datetime($pit); $datetime = \davina\helpers\pit\pit_to_datetime($pit);
return (new struct_datetime( return (new struct_datetime(
new struct_date( new struct_date(
$datetime->date->year, $datetime->date->year,

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\helpers\pit; namespace davina\helpers\pit;
require_once('helpers/call.php'); require_once('helpers/call.php');
require_once('helpers/string.php'); require_once('helpers/string.php');
@ -90,24 +90,24 @@ function date_to_string(
struct_date $date struct_date $date
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
'{{year}}{{month}}{{day}}', '{{year}}{{month}}{{day}}',
[ [
'year' => \davigil\helpers\call\convey( 'year' => \davina\helpers\call\convey(
$date->year, $date->year,
[ [
fn($x) => \sprintf('%u', $x), fn($x) => \sprintf('%u', $x),
fn($x) => \str_pad($x, 4, '0', \STR_PAD_LEFT), fn($x) => \str_pad($x, 4, '0', \STR_PAD_LEFT),
] ]
), ),
'month' => \davigil\helpers\call\convey( 'month' => \davina\helpers\call\convey(
$date->month, $date->month,
[ [
fn($x) => \sprintf('%u', $x), fn($x) => \sprintf('%u', $x),
fn($x) => \str_pad($x, 2, '0', \STR_PAD_LEFT), fn($x) => \str_pad($x, 2, '0', \STR_PAD_LEFT),
] ]
), ),
'day' => \davigil\helpers\call\convey( 'day' => \davina\helpers\call\convey(
$date->day, $date->day,
[ [
fn($x) => \sprintf('%u', $x), fn($x) => \sprintf('%u', $x),
@ -125,24 +125,24 @@ function time_to_string(
struct_time $time struct_time $time
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
'{{hour}}{{minute}}{{second}}', '{{hour}}{{minute}}{{second}}',
[ [
'hour' => \davigil\helpers\call\convey( 'hour' => \davina\helpers\call\convey(
$time->hour, $time->hour,
[ [
fn($x) => \sprintf('%u', $x), fn($x) => \sprintf('%u', $x),
fn($x) => \str_pad($x, 2, '0', \STR_PAD_LEFT), fn($x) => \str_pad($x, 2, '0', \STR_PAD_LEFT),
] ]
), ),
'minute' => \davigil\helpers\call\convey( 'minute' => \davina\helpers\call\convey(
$time->minute, $time->minute,
[ [
fn($x) => \sprintf('%u', $x), fn($x) => \sprintf('%u', $x),
fn($x) => \str_pad($x, 2, '0', \STR_PAD_LEFT), fn($x) => \str_pad($x, 2, '0', \STR_PAD_LEFT),
] ]
), ),
'second' => \davigil\helpers\call\convey( 'second' => \davina\helpers\call\convey(
$time->second, $time->second,
[ [
fn($x) => \sprintf('%u', $x), fn($x) => \sprintf('%u', $x),
@ -160,7 +160,7 @@ function datetime_to_string(
struct_datetime $datetime struct_datetime $datetime
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
'{{date}}{{macro_time}}', '{{date}}{{macro_time}}',
[ [
'date' => date_to_string($datetime->date), 'date' => date_to_string($datetime->date),
@ -169,7 +169,7 @@ function datetime_to_string(
? ?
'' ''
: :
\davigil\helpers\string_\coin( \davina\helpers\string_\coin(
'T{{time}}{{utc}}', 'T{{time}}{{utc}}',
[ [
'time' => time_to_string($datetime->time), 'time' => time_to_string($datetime->time),

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\helpers\string_; namespace davina\helpers\string_;
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil; namespace davina;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
require_once('base.php'); require_once('base.php');
@ -14,25 +14,25 @@ require_once('conf.php');
function main( function main(
) : void ) : void
{ {
\davigil\conf\load('conf.json'); \davina\conf\load('conf.json');
\davigil\set_parameters([]); \davina\set_parameters([]);
\date_default_timezone_set(\davigil\conf\get()->settings->timezone); \date_default_timezone_set(\davina\conf\get()->settings->timezone);
$source = \davigil\sources\make( $source = \davina\sources\make(
[ [
'kind' => \davigil\conf\get()->source->kind, 'kind' => \davina\conf\get()->source->kind,
'data' => \davigil\conf\get()->source->data, 'data' => \davina\conf\get()->source->data,
] ]
); );
$principal_backend = new \davigil\overwrites\class_principle_backend(); $principal_backend = new \davina\overwrites\class_principle_backend();
$server = new \Sabre\DAV\Server( $server = new \Sabre\DAV\Server(
[ [
new \Sabre\CalDAV\Principal\Collection($principal_backend), new \Sabre\CalDAV\Principal\Collection($principal_backend),
new \Sabre\CalDAV\CalendarRoot($principal_backend, new \davigil\overwrites\class_caldav_backend($source)), new \Sabre\CalDAV\CalendarRoot($principal_backend, new \davina\overwrites\class_caldav_backend($source)),
] ]
); );
@ -40,11 +40,11 @@ function main(
$server->addPlugin( $server->addPlugin(
new \Sabre\DAV\Auth\Plugin( new \Sabre\DAV\Auth\Plugin(
\davigil\overwrites\make_auth_backend( \davina\overwrites\make_auth_backend(
$source, $source,
[ [
'kind' => \davigil\conf\get()->auth->kind, 'kind' => \davina\conf\get()->auth->kind,
'data' => \davigil\conf\get()->auth->data, 'data' => \davina\conf\get()->auth->data,
] ]
) )
) )

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\model; namespace davina\model;
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\overwrites; namespace davina\overwrites;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
require_once('sources/_interface.php'); require_once('sources/_interface.php');
@ -11,7 +11,7 @@ require_once('overwrites/auths/basic.php');
/** /**
*/ */
function make_auth_backend( function make_auth_backend(
\davigil\sources\interface_source $source, \davina\sources\interface_source $source,
array $descriptor array $descriptor
) : \Sabre\DAV\Auth\Backend\BackendInterface ) : \Sabre\DAV\Auth\Backend\BackendInterface
{ {
@ -19,12 +19,12 @@ function make_auth_backend(
{ {
case 'none': case 'none':
{ {
return (new \davigil\overwrites\class_auth_backend_none()); return (new \davina\overwrites\class_auth_backend_none());
break; break;
} }
case 'basic': case 'basic':
{ {
return (new \davigil\overwrites\class_auth_backend_basic($source)); return (new \davina\overwrites\class_auth_backend_basic($source));
break; break;
} }
default: default:

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\overwrites; namespace davina\overwrites;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
require_once('base.php'); require_once('base.php');
@ -16,18 +16,18 @@ class class_auth_backend_basic
/** /**
*/ */
private \davigil\sources\interface_source $source; private \davina\sources\interface_source $source;
/** /**
*/ */
public function __construct( public function __construct(
\davigil\sources\interface_source $source \davina\sources\interface_source $source
) )
{ {
// parent::__construct(); // parent::__construct();
$this->source = $source; $this->source = $source;
$this->setRealm('davigil'); $this->setRealm('davina');
} }
@ -45,7 +45,7 @@ class class_auth_backend_basic
/** /**
* @todo check for security * @todo check for security
*/ */
\davigil\set_parameters($parameters); \davina\set_parameters($parameters);
$data = $this->source->get(/*$parameters*/[]); $data = $this->source->get(/*$parameters*/[]);
return ($data !== null); return ($data !== null);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\overwrites; namespace davina\overwrites;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
require_once('sources/_interface.php'); require_once('sources/_interface.php');

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\overwrites; namespace davina\overwrites;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
require_once('helpers/call.php'); require_once('helpers/call.php');
@ -20,13 +20,13 @@ class class_caldav_backend
/** /**
*/ */
private \davigil\sources\interface_source $source; private \davina\sources\interface_source $source;
/** /**
*/ */
public function __construct( public function __construct(
\davigil\sources\interface_source $source \davina\sources\interface_source $source
) )
{ {
// parent::__construct(); // parent::__construct();
@ -50,7 +50,7 @@ class class_caldav_backend
string $tag string $tag
) : string ) : string
{ {
return \davigil\helpers\call\convey( return \davina\helpers\call\convey(
$tag, $tag,
[ [
fn($x) => \strtolower($x), fn($x) => \strtolower($x),
@ -70,31 +70,31 @@ class class_caldav_backend
* @todo outsource * @todo outsource
*/ */
private function event_to_vevent( private function event_to_vevent(
\davigil\model\struct_event $event \davina\model\struct_event $event
) : \davigil\helpers\ics\struct_vevent ) : \davina\helpers\ics\struct_vevent
{ {
$vevent = new \davigil\helpers\ics\struct_vevent(); $vevent = new \davina\helpers\ics\struct_vevent();
{ {
$vevent->uid = $event->id; $vevent->uid = $event->id;
$vevent->dtstamp = \davigil\helpers\ics\datetime_from_unix_timestamp($event->begin); $vevent->dtstamp = \davina\helpers\ics\datetime_from_unix_timestamp($event->begin);
$vevent->dtstart = new \davigil\helpers\ics\struct_dt( $vevent->dtstart = new \davina\helpers\ics\struct_dt(
'', '',
\davigil\helpers\ics\datetime_from_unix_timestamp($event->begin) \davina\helpers\ics\datetime_from_unix_timestamp($event->begin)
); );
$vevent->dtend = ( $vevent->dtend = (
($event->end === null) ($event->end === null)
? ?
null null
: :
new \davigil\helpers\ics\struct_dt( new \davina\helpers\ics\struct_dt(
'', '',
\davigil\helpers\ics\datetime_from_unix_timestamp($event->end) \davina\helpers\ics\datetime_from_unix_timestamp($event->end)
) )
); );
$vevent->summary = $event->title; $vevent->summary = $event->title;
$vevent->location = $event->location; $vevent->location = $event->location;
$vevent->description = $event->description; $vevent->description = $event->description;
$vevent->class = \davigil\helpers\ics\enum_class::public_; $vevent->class = \davina\helpers\ics\enum_class::public_;
$vevent->categories = $event->tags; $vevent->categories = $event->tags;
} }
return $vevent; return $vevent;
@ -106,15 +106,15 @@ class class_caldav_backend
*/ */
private function events_to_vcalendar( private function events_to_vcalendar(
array $events array $events
) : \davigil\helpers\ics\struct_vcalendar ) : \davina\helpers\ics\struct_vcalendar
{ {
$vcalendar = new \davigil\helpers\ics\struct_vcalendar(); $vcalendar = new \davina\helpers\ics\struct_vcalendar();
{ {
$vcalendar->version = '2.0'; $vcalendar->version = '2.0';
/** /**
* @todo conf * @todo conf
*/ */
$vcalendar->prodid = 'davigil'; $vcalendar->prodid = 'davina';
$vcalendar->method = 'PUBLISH'; $vcalendar->method = 'PUBLISH';
$vcalendar->events = \array_map( $vcalendar->events = \array_map(
fn($event) => $this->event_to_vevent($event), fn($event) => $this->event_to_vevent($event),
@ -245,7 +245,7 @@ class class_caldav_backend
else else
{ {
$vcalendar = $this->events_to_vcalendar($events); $vcalendar = $this->events_to_vcalendar($events);
$ics = \davigil\helpers\ics\vcalendar_encode($vcalendar); $ics = \davina\helpers\ics\vcalendar_encode($vcalendar);
return [ return [
'calendardata' => $ics, 'calendardata' => $ics,
'uri' => $objectUri, 'uri' => $objectUri,

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\overwrites; namespace davina\overwrites;
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\sources; namespace davina\sources;
require_once('sources/ics_feed.php'); require_once('sources/ics_feed.php');

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\sources; namespace davina\sources;
/** /**
@ -18,7 +18,7 @@ interface interface_source
*/ */
public function get( public function get(
array $parameters array $parameters
) : \davigil\model\struct_calendar ) : \davina\model\struct_calendar
; ;
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace davigil\sources; namespace davina\sources;
require_once('helpers/string.php'); require_once('helpers/string.php');
require_once('helpers/cache.php'); require_once('helpers/cache.php');
@ -42,18 +42,18 @@ class class_source_ics_feed
$this->url_template = $url_template; $this->url_template = $url_template;
$this->lifetime = $lifetime; $this->lifetime = $lifetime;
$this->combine = $combine; $this->combine = $combine;
$this->cache_file = \davigil\helpers\call\convey( $this->cache_file = \davina\helpers\call\convey(
new \davigil\helpers\cache\class_cache_file('data'), new \davina\helpers\cache\class_cache_file('data'),
[ [
fn($x) => new \davigil\helpers\cache\class_cache_encoded( fn($x) => new \davina\helpers\cache\class_cache_encoded(
$x, $x,
fn($value) => \json_encode($value), fn($value) => \json_encode($value),
fn($value_encoded) => \json_decode($value_encoded, true) fn($value_encoded) => \json_decode($value_encoded, true)
), ),
] ]
); );
$this->cache_memory = \davigil\helpers\call\convey( $this->cache_memory = \davina\helpers\call\convey(
(new \davigil\helpers\cache\class_cache_memory()), (new \davina\helpers\cache\class_cache_memory()),
[ [
] ]
); );
@ -66,7 +66,7 @@ class class_source_ics_feed
$parameters $parameters
) : string ) : string
{ {
return \davigil\helpers\string_\coin( return \davina\helpers\string_\coin(
$this->url_template, $this->url_template,
$parameters $parameters
); );
@ -76,13 +76,13 @@ class class_source_ics_feed
/** /**
*/ */
private function vcalendar_to_calendar( private function vcalendar_to_calendar(
\davigil\helpers\ics\struct_vcalendar $vcalendar \davina\helpers\ics\struct_vcalendar $vcalendar
) : \davigil\model\struct_calendar ) : \davina\model\struct_calendar
{ {
return ( return (
new \davigil\model\struct_calendar( new \davina\model\struct_calendar(
\array_map( \array_map(
fn($vevent) => (new \davigil\model\struct_event( fn($vevent) => (new \davina\model\struct_event(
// id // id
$vevent->uid, $vevent->uid,
// title // title
@ -104,14 +104,14 @@ class class_source_ics_feed
$vevent->summary $vevent->summary
), ),
// begin // begin
\davigil\helpers\ics\datetime_to_unix_timestamp($vevent->dtstart->value), \davina\helpers\ics\datetime_to_unix_timestamp($vevent->dtstart->value),
// end // end
( (
($vevent->dtend === null) ($vevent->dtend === null)
? ?
null null
: :
\davigil\helpers\ics\datetime_to_unix_timestamp($vevent->dtend->value) \davina\helpers\ics\datetime_to_unix_timestamp($vevent->dtend->value)
), ),
// location // location
$vevent->location, $vevent->location,
@ -153,9 +153,9 @@ class class_source_ics_feed
case 200: case 200:
{ {
$ics = $response->getBody(); $ics = $response->getBody();
$vcalendar = \davigil\helpers\ics\vcalendar_decode($ics); $vcalendar = \davina\helpers\ics\vcalendar_decode($ics);
$calendar = $this->vcalendar_to_calendar($vcalendar); $calendar = $this->vcalendar_to_calendar($vcalendar);
$calendar_raw = \davigil\model\calendar_to_raw($calendar); $calendar_raw = \davina\model\calendar_to_raw($calendar);
return $calendar_raw; return $calendar_raw;
break; break;
} }
@ -180,14 +180,14 @@ class class_source_ics_feed
*/ */
public function get( public function get(
array $parameters array $parameters
) : \davigil\model\struct_calendar ) : \davina\model\struct_calendar
{ {
$url = $this->url(\davigil\get_parameters()); $url = $this->url(\davina\get_parameters());
$key = $url; $key = $url;
$f1 = fn() => $this->retrieve( $f1 = fn() => $this->retrieve(
$url $url
); );
$f2 = fn() => \davigil\helpers\cache\get( $f2 = fn() => \davina\helpers\cache\get(
$this->cache_file, $this->cache_file,
$key, $key,
$f1, $f1,
@ -195,7 +195,7 @@ class class_source_ics_feed
'ttl' => $this->lifetime, 'ttl' => $this->lifetime,
] ]
); );
$f3 = fn() => \davigil\helpers\cache\get( $f3 = fn() => \davina\helpers\cache\get(
$this->cache_memory, $this->cache_memory,
$key, $key,
$f2, $f2,
@ -203,7 +203,7 @@ class class_source_ics_feed
'ttl' => null, 'ttl' => null,
] ]
); );
return \davigil\model\calendar_from_raw( return \davina\model\calendar_from_raw(
($f3)() ($f3)()
); );
} }