ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
9final class ilRuntime
10{
14 private static $instance = null;
15
19 private function __construct(){}
20
24 public static function getInstance()
25 {
26 if(self::$instance === null)
27 {
28 self::$instance = new self();
29 }
30
31 return self::$instance;
32 }
33
38 public function isHHVM()
39 {
40 return defined('HHVM_VERSION');
41 }
42
47 public function isPHP()
48 {
49 return !$this->isHHVM();
50 }
51
52
56 public function isFPM() {
57 return (php_sapi_name() == 'fpm-fcgi');
58 }
59
63 public function getVersion()
64 {
65 if($this->isHHVM())
66 {
67 return HHVM_VERSION;
68 }
69 else
70 {
71 return PHP_VERSION;
72 }
73 }
74
78 public function getName()
79 {
80 if($this->isHHVM())
81 {
82 return 'HHVM';
83 }
84 else
85 {
86 return 'PHP';
87 }
88 }
89
93 public function __toString()
94 {
95 return $this->getName() . ' ' . $this->getVersion();
96 }
97
101 public function getReportedErrorLevels()
102 {
103 if($this->isHHVM())
104 {
105 return ini_get('hhvm.log.runtime_error_reporting_level');
106 }
107 else
108 {
109 return ini_get('error_reporting');
110 }
111 }
112
116 public function shouldLogErrors()
117 {
118 if($this->isHHVM())
119 {
120 return (bool)ini_get('hhvm.log.use_log_file');
121 }
122 else
123 {
124 return (bool)ini_get('log_errors');
125 }
126 }
127
131 public function shouldDisplayErrors()
132 {
133 if($this->isHHVM())
134 {
135 return (bool)ini_get('hhvm.debug.server_error_message');
136 }
137 else
138 {
139 return (bool)ini_get('display_errors');
140 }
141 }
142}
__toString()
A string representation of the runtime.
__construct()
The runtime is a constant state during one request, so please use the public static getInstance() to ...
isPHP()
Returns true when the runtime used is PHP.
isHHVM()
Returns true when the runtime used is HHVM.
static getInstance()
static $instance