Start bootstrapping the container definitions into descrete classes.
This commit is contained in:
parent
390a8a802a
commit
6742ffa671
@ -3,6 +3,7 @@
|
|||||||
namespace Slovocast\Feed;
|
namespace Slovocast\Feed;
|
||||||
|
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
|
use DOMElement;
|
||||||
use Slovocast\Feed\FeedGeneratorInterface;
|
use Slovocast\Feed\FeedGeneratorInterface;
|
||||||
use Slovocast\Domain\Entity\Channel;
|
use Slovocast\Domain\Entity\Channel;
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ class FeedGenerator implements FeedGeneratorInterface
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->document = new DOMDocument();
|
$this->document = new DOMDocument();
|
||||||
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +35,8 @@ class UploadEpisodeFileAction extends Handler
|
|||||||
$this->filesystem->writeStream($file->getStream());
|
$this->filesystem->writeStream($file->getStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save the file location to the database somewhere
|
||||||
|
|
||||||
return $this->json([ 'message' => 'Uploaded Episode file' ]);
|
return $this->json([ 'message' => 'Uploaded Episode file' ]);
|
||||||
} catch (FilesystemException | UnableToWriteFile $e) {
|
} catch (FilesystemException | UnableToWriteFile $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
|
24
app/src/Infrastructure/Application/LoggerSetup.php
Normal file
24
app/src/Infrastructure/Application/LoggerSetup.php
Normal 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;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
14
app/src/Infrastructure/Application/SetupInterface.php
Normal file
14
app/src/Infrastructure/Application/SetupInterface.php
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user