class UserController
{
private $users;
public function __construct(UserRepository $users)
{
$this->users = $users;
}
public function all()
{
return new Response($this->users->findAll());
}
}
class UserController
{
public function all(UserRepository $users)
{
return new Response($users->findAll());
}
}
<div class="box">
<table class="table table-bordered bg-white">
<thead class="thead-dark">
<tr>
<th>Марка</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
<?php foreach ($table as $key => $value): ?>
<tr>
<td><?= $key ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
interface ConnectionInterface
{
public function connect(...$args);
}
class MySQLConnection implements ConnectionInterface
{
public function connect(...$args)
{
}
}
class PgSQLConnection implements ConnectionInterface
{
public function connect(...$args)
{
}
}
class Connection
{
private $connection;
public function __construct(ConnectionInterface $connection)
{
$this->connection = $connection;
}
}