28 lines
584 B
PHP
28 lines
584 B
PHP
<?php
|
|
|
|
namespace Ulmus\Container;
|
|
|
|
use Ulmus\ConnectionAdapter;
|
|
|
|
class AdapterProxy
|
|
{
|
|
public array $connections = [];
|
|
|
|
public function __construct(...$arguments)
|
|
{
|
|
$this->push(array_filter($arguments));
|
|
}
|
|
|
|
public function push(array|ConnectionAdapter $connection) : void
|
|
{
|
|
foreach((array) $connection as $adapter) {
|
|
foreach($this->connections as $existing) {
|
|
if ($adapter === $existing) {
|
|
continue 2;
|
|
}
|
|
}
|
|
|
|
$this->connections[] = $adapter;
|
|
}
|
|
}
|
|
} |