ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilRuntime.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 final class ilRuntime
10 {
14  private static $instance = null;
15 
19  private function __construct()
20  {
21  }
22 
26  public static function getInstance()
27  {
28  if (self::$instance === null) {
29  self::$instance = new self();
30  }
31 
32  return self::$instance;
33  }
34 
39  public function isHHVM()
40  {
41  return defined('HHVM_VERSION');
42  }
43 
48  public function isPHP()
49  {
50  return !$this->isHHVM();
51  }
52 
53 
57  public function isFPM()
58  {
59  return (php_sapi_name() == 'fpm-fcgi');
60  }
61 
65  public function getVersion()
66  {
67  if ($this->isHHVM()) {
68  return HHVM_VERSION;
69  } else {
70  return PHP_VERSION;
71  }
72  }
73 
77  public function getName()
78  {
79  if ($this->isHHVM()) {
80  return 'HHVM';
81  } else {
82  return 'PHP';
83  }
84  }
85 
89  public function __toString()
90  {
91  return $this->getName() . ' ' . $this->getVersion();
92  }
93 
97  public function getReportedErrorLevels()
98  {
99  if ($this->isHHVM()) {
100  return ini_get('hhvm.log.runtime_error_reporting_level');
101  } else {
102  return ini_get('error_reporting');
103  }
104  }
105 
109  public function shouldLogErrors()
110  {
111  if ($this->isHHVM()) {
112  return (bool) ini_get('hhvm.log.use_log_file');
113  } else {
114  return (bool) ini_get('log_errors');
115  }
116  }
117 
121  public function shouldDisplayErrors()
122  {
123  if ($this->isHHVM()) {
124  return (bool) ini_get('hhvm.debug.server_error_message');
125  } else {
126  return (bool) ini_get('display_errors');
127  }
128  }
129 }
static getInstance()
isPHP()
Returns true when the runtime used is PHP.
isHHVM()
Returns true when the runtime used is HHVM.
static $instance
getReportedErrorLevels()
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
__construct()
The runtime is a constant state during one request, so please use the public static getInstance() to ...
__toString()
A string representation of the runtime.