<?php
use Psr\Container\ContainerInterface;

return [
    'databases' => function(ContainerInterface $container) {
        $env = $container->get('env');
        $arr = [
            ORM::DEFAULT_CONNECTION => (object) [
                'host' => $env['MYSQL_HOST'],
                'database' => $env['MYSQL_DATABASE'],
                'username' => $env['MYSQL_USER'],
                'password' => $env['MYSQL_PASSWORD']
            ]
        ];
        if (isset($env['MYSQL_PORT'])) {
            $arr[ORM::DEFAULT_CONNECTION]->port = $env['MYSQL_PORT'];
        }
        return (object) $arr;
    }
];
