Start bootstrapping the container definitions into descrete classes.

This commit is contained in:
Dave Smith-Hayes 2025-06-18 21:08:58 -04:00
parent 390a8a802a
commit 6742ffa671
4 changed files with 42 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Slovocast\Feed;
use DOMDocument;
use DOMElement;
use Slovocast\Feed\FeedGeneratorInterface;
use Slovocast\Domain\Entity\Channel;
@ -13,6 +14,7 @@ class FeedGenerator implements FeedGeneratorInterface
public function __construct()
{
$this->document = new DOMDocument();
$this->reset();
}
/**

View File

@ -35,6 +35,8 @@ class UploadEpisodeFileAction extends Handler
$this->filesystem->writeStream($file->getStream());
}
// save the file location to the database somewhere
return $this->json([ 'message' => 'Uploaded Episode file' ]);
} catch (FilesystemException | UnableToWriteFile $e) {
$this->logger->error($e->getMessage());

View File

@ -0,0 +1,24 @@
<?php
namespace Slovocast\Infrastructure\Application;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Monolog\Handler\StreamHandler;
use Monolog\Level;
use Monolog\Logger;
use Slovocast\Infrastructure\Application\SetupInterface;
class LoggerSetup implements SetupInterface
{
public function setup(): array
{
return [
LoggerInterface::class => function (ContainerInterface $c) {
$logger = new Logger("default");
$logger->pushHandler(new StreamHandler('php://stdout', Level::Info));
return $logger;
}
];
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Slovocast\Infrastructure\Application;
use Psr\Container\ContainerInterface as Container;
interface SetupInterface
{
/**
* @param Container $container
* @return array<string, callable> A function that instantiates the class
*/
public function setup(): array;
}