@@ -25,39 +25,39 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function loadEnv(string $dir): void |
| 27 | 27 | { |
| 28 | - require_once $dir . '/vendor/autoload.php'; |
|
| 28 | + require_once $dir.'/vendor/autoload.php'; |
|
| 29 | 29 | |
| 30 | 30 | if (!class_exists(Dotenv::class)) { |
| 31 | - fwrite(STDERR, 'ERROR: No se ha cargado la clase Dotenv' . PHP_EOL); |
|
| 31 | + fwrite(STDERR, 'ERROR: No se ha cargado la clase Dotenv'.PHP_EOL); |
|
| 32 | 32 | exit(1); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | try { |
| 36 | 36 | // Load environment variables from .env file |
| 37 | - if (file_exists($dir . '/.env')) { |
|
| 37 | + if (file_exists($dir.'/.env')) { |
|
| 38 | 38 | $dotenv = Dotenv::createMutable($dir, '.env'); |
| 39 | 39 | $dotenv->load(); |
| 40 | 40 | } else { |
| 41 | - fwrite(STDERR, 'ERROR: no existe el fichero .env' . PHP_EOL); |
|
| 41 | + fwrite(STDERR, 'ERROR: no existe el fichero .env'.PHP_EOL); |
|
| 42 | 42 | exit(1); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Overload (if they exist) with .env.docker or .env.local |
| 46 | - if (isset($_SERVER['DOCKER']) && file_exists($dir . '/.env.docker')) { |
|
| 46 | + if (isset($_SERVER['DOCKER']) && file_exists($dir.'/.env.docker')) { |
|
| 47 | 47 | $dotenv = Dotenv::createMutable($dir, '.env.docker'); |
| 48 | 48 | $dotenv->load(); |
| 49 | - } elseif (file_exists($dir . '/.env.local')) { |
|
| 49 | + } elseif (file_exists($dir.'/.env.local')) { |
|
| 50 | 50 | $dotenv = Dotenv::createMutable($dir, '.env.local'); |
| 51 | 51 | $dotenv->load(); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Requiring Variables to be set |
| 55 | - $dotenv->required([ 'DATABASE_NAME', 'DATABASE_USER', 'DATABASE_PASSWD', 'SERVER_VERSION' ]); |
|
| 56 | - $dotenv->required([ 'ENTITY_DIR' ]); |
|
| 55 | + $dotenv->required(['DATABASE_NAME', 'DATABASE_USER', 'DATABASE_PASSWD', 'SERVER_VERSION']); |
|
| 56 | + $dotenv->required(['ENTITY_DIR']); |
|
| 57 | 57 | } catch (Throwable $e) { |
| 58 | 58 | fwrite( |
| 59 | 59 | STDERR, |
| 60 | - 'EXCEPCIÓN: ' . $e->getCode() . ' - ' . $e->getMessage() |
|
| 60 | + 'EXCEPCIÓN: '.$e->getCode().' - '.$e->getMessage() |
|
| 61 | 61 | ); |
| 62 | 62 | exit(1); |
| 63 | 63 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } catch (Throwable $e) { |
| 81 | 81 | fwrite( |
| 82 | 82 | STDERR, |
| 83 | - 'EXCEPCIÓN: ' . $e->getCode() . ' - ' . $e->getMessage() |
|
| 83 | + 'EXCEPCIÓN: '.$e->getCode().' - '.$e->getMessage() |
|
| 84 | 84 | ); |
| 85 | 85 | exit(1); |
| 86 | 86 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } catch (Throwable $e) { |
| 117 | 117 | fwrite( |
| 118 | 118 | STDERR, |
| 119 | - 'EXCEPCIÓN: ' . $e->getCode() . ' - ' . $e->getMessage() |
|
| 119 | + 'EXCEPCIÓN: '.$e->getCode().' - '.$e->getMessage() |
|
| 120 | 120 | ); |
| 121 | 121 | exit(1); |
| 122 | 122 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | final class DoctrineConnector |
| 23 | 23 | { |
| 24 | - private static EntityManager|null $instance = null; |
|
| 24 | + private static EntityManager | null $instance = null; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Generate the Entity Manager |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $_ENV['SERVER_VERSION'], |
| 44 | 44 | ) |
| 45 | 45 | ) { |
| 46 | - fwrite(STDERR, 'Faltan variables de entorno por definir' . PHP_EOL); |
|
| 46 | + fwrite(STDERR, 'Faltan variables de entorno por definir'.PHP_EOL); |
|
| 47 | 47 | exit(1); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | 'serverVersion' => $_ENV['SERVER_VERSION'], |
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | - $entityDir = dirname(__DIR__, 2) . '/' . $_ENV['ENTITY_DIR']; |
|
| 62 | + $entityDir = dirname(__DIR__, 2).'/'.$_ENV['ENTITY_DIR']; |
|
| 63 | 63 | // $queryCache = new PhpFilesAdapter('doctrine_queries'); |
| 64 | 64 | // $metadataCache = new PhpFilesAdapter('doctrine_metadata'); |
| 65 | 65 | // $resultsCache = new PhpFilesAdapter('doctrine_results'); |
| 66 | 66 | $config = ORMSetup::createAttributeMetadataConfiguration( |
| 67 | - paths: [ $entityDir ], // paths to mapped entities |
|
| 68 | - isDevMode: true, // developper mode |
|
| 67 | + paths: [$entityDir], // paths to mapped entities |
|
| 68 | + isDevMode: true, // developper mode |
|
| 69 | 69 | proxyDir: (string) ini_get('sys_temp_dir') // Proxy dir |
| 70 | 70 | ); |
| 71 | 71 | // $config->setQueryCache($queryCache); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $entityManager = new EntityManager($connection, $config); |
| 82 | 82 | } catch (Throwable $e) { |
| 83 | 83 | $msg = sprintf('ERROR (%d): %s', $e->getCode(), $e->getMessage()); |
| 84 | - fwrite(STDERR, $msg . PHP_EOL); |
|
| 84 | + fwrite(STDERR, $msg.PHP_EOL); |
|
| 85 | 85 | exit(1); |
| 86 | 86 | } |
| 87 | 87 | |