original_string: public static function initEnv($directory = null)
      {
          if ($directory !== null && file_exists($directory . DIRECTORY_SEPARATOR . '.env')) {
              $dotenv = new \Dotenv\Dotenv($directory);
              $dotenv->load();
          }
  
          // Define main Yii environment variables
          $debug = self::env('YII_DEBUG', false);
          if ($debug !== false) {
              define('YII_DEBUG', (bool)$debug);
              if (YII_DEBUG) {
                  error_reporting(E_ALL);
              }
          }
          $env = self::env('YII_ENV', false);
          if ($env !== false) {
              define('YII_ENV', $env);
          }
      }
code: public static function initEnv($directory = null)
      {
          if ($directory !== null && file_exists($directory . DIRECTORY_SEPARATOR . '.env')) {
              $dotenv = new \Dotenv\Dotenv($directory);
              $dotenv->load();
          }
  
          // Define main Yii environment variables
          $debug = self::env('YII_DEBUG', false);
          if ($debug !== false) {
              define('YII_DEBUG', (bool)$debug);
              if (YII_DEBUG) {
                  error_reporting(E_ALL);
              }
          }
          $env = self::env('YII_ENV', false);
          if ($env !== false) {
              define('YII_ENV', $env);
          }
      }
code_tokens: public static function initEnv ( $ directory = null ) { if ( $ directory !== null && file_exists ( $ directory . DIRECTORY_SEPARATOR . '.env' ) ) { $ dotenv = new \ Dotenv \ Dotenv ( $ directory ) ; $ dotenv -> load ( ) ; } // Define main Yii environment variables $ debug = self :: env ( 'YII_DEBUG' , false ) ; if ( $ debug !== false ) { define ( 'YII_DEBUG' , ( bool ) $ debug ) ; if ( YII_DEBUG ) { error_reporting ( E_ALL ) ; } } $ env = self :: env ( 'YII_ENV' , false ) ; if ( $ env !== false ) { define ( 'YII_ENV' , $ env ) ; } }
docstring: Init the Yii environment from environment variables.
  
  If $directory is passed and contains a `.env` file, that file is loaded
  with `Dotenv` first.
  
  @param string|null $directory the directory to check for an `.env` file
docstring_tokens: Init the Yii environment from environment variables .