public function EnvironmentType()
 {
     if (Director::isLive()) {
         return "live";
     } else {
         if (Director::isTest()) {
             return "test";
         } else {
             return "dev";
         }
     }
 }
 /**
  * This function will return true if the site is in a live environment. For information about
  * environment types, see {@link Director::set_environment_type()}.
  *
  * @return bool
  */
 public static function isLive()
 {
     return !(Director::isDev() || Director::isTest());
 }
 /**
  * Returns false if the non-prefilterable parts of the rule aren't met, and true if they are
  *
  * @param array $rules
  * @return bool|string
  */
 public function matchesVariantRules($rules)
 {
     $matches = "undefined";
     // Needs to be truthy, but not true
     foreach ($rules as $k => $v) {
         switch (strtolower($k)) {
             case 'classexists':
             case 'moduleexists':
                 break;
             case 'environment':
                 switch (strtolower($v)) {
                     case 'live':
                         $matches = $matches && Director::isLive();
                         break;
                     case 'test':
                         $matches = $matches && Director::isTest();
                         break;
                     case 'dev':
                         $matches = $matches && Director::isDev();
                         break;
                     default:
                         user_error('Unknown environment ' . $v . ' in config fragment', E_USER_ERROR);
                 }
                 break;
             case 'envvarset':
                 $matches = $matches && isset($_ENV[$v]);
                 break;
             case 'constantdefined':
                 $matches = $matches && defined($v);
                 break;
             default:
                 $matches = $matches && (isset($_ENV[$k]) && $_ENV[$k] == $v || defined($k) && constant($k) == $v);
                 break;
         }
         if ($matches === false) {
             return $matches;
         }
     }
     return $matches;
 }
 /**
  * Tests isDev, isTest, isLive set from querystring
  */
 public function testQueryIsEnvironment()
 {
     // Reset
     unset($_SESSION['isDev']);
     unset($_SESSION['isLive']);
     unset($_GET['isTest']);
     unset($_GET['isDev']);
     $_SESSION = $_SESSION ?: array();
     // Test isDev=1
     $_GET['isDev'] = '1';
     $this->assertTrue(Director::isDev());
     $this->assertFalse(Director::isTest());
     $this->assertFalse(Director::isLive());
     // Test persistence
     unset($_GET['isDev']);
     $this->assertTrue(Director::isDev());
     $this->assertFalse(Director::isTest());
     $this->assertFalse(Director::isLive());
     // Test change to isTest
     $_GET['isTest'] = '1';
     $this->assertFalse(Director::isDev());
     $this->assertTrue(Director::isTest());
     $this->assertFalse(Director::isLive());
     // Test persistence
     unset($_GET['isTest']);
     $this->assertFalse(Director::isDev());
     $this->assertTrue(Director::isTest());
     $this->assertFalse(Director::isLive());
 }