welcome back to dyb-tech

This commit is contained in:
Daniel Guzman
2024-05-18 02:28:01 +02:00
parent 9513cdba09
commit 9f30bc98c7
6149 changed files with 668407 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Schema\AbstractAsset;
use function in_array;
/** @deprecated Implement your own include/exclude mechanism */
class BlacklistSchemaAssetFilter
{
/** @var string[] */
private array $blacklist;
/** @param string[] $blacklist */
public function __construct(array $blacklist)
{
$this->blacklist = $blacklist;
}
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}
return ! in_array($assetName, $this->blacklist, true);
}
}
@@ -0,0 +1,27 @@
<?php
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use Doctrine\Persistence\AbstractManagerRegistry;
class ManagerRegistryAwareConnectionProvider implements ConnectionProvider
{
private AbstractManagerRegistry $managerRegistry;
public function __construct(AbstractManagerRegistry $managerRegistry)
{
$this->managerRegistry = $managerRegistry;
}
public function getDefaultConnection(): Connection
{
return $this->managerRegistry->getConnection();
}
public function getConnection(string $name): Connection
{
return $this->managerRegistry->getConnection($name);
}
}
@@ -0,0 +1,27 @@
<?php
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Schema\AbstractAsset;
use function preg_match;
class RegexSchemaAssetFilter
{
private string $filterExpression;
public function __construct(string $filterExpression)
{
$this->filterExpression = $filterExpression;
}
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}
return (bool) preg_match($this->filterExpression, $assetName);
}
}
@@ -0,0 +1,32 @@
<?php
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Schema\AbstractAsset;
/**
* Manages schema filters passed to Connection::setSchemaAssetsFilter()
*/
class SchemaAssetsFilterManager
{
/** @var callable[] */
private array $schemaAssetFilters;
/** @param callable[] $schemaAssetFilters */
public function __construct(array $schemaAssetFilters)
{
$this->schemaAssetFilters = $schemaAssetFilters;
}
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
foreach ($this->schemaAssetFilters as $schemaAssetFilter) {
if ($schemaAssetFilter($assetName) === false) {
return false;
}
}
return true;
}
}