ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
55 public function getVersion()
56 {
57 if($this->isHHVM())
58 {
59 return HHVM_VERSION;
60 }
61 else
62 {
63 return PHP_VERSION;
64 }
65 }
66
70 public function getName()
71 {
72 if($this->isHHVM())
73 {
74 return 'HHVM';
75 }
76 else
77 {
78 return 'PHP';
79 }
80 }
81
85 public function __toString()
86 {
87 return $this->getName() . ' ' . $this->getVersion();
88 }
89
93 public function getReportedErrorLevels()
94 {
95 if($this->isHHVM())
96 {
97 return ini_get('hhvm.log.runtime_error_reporting_level');
98 }
99 else
100 {
101 return ini_get('error_reporting');
102 }
103 }
104
108 public function shouldLogErrors()
109 {
110 if($this->isHHVM())
111 {
112 return (bool)ini_get('hhvm.log.use_log_file');
113 }
114 else
115 {
116 return (bool)ini_get('log_errors');
117 }
118 }
119
123 public function shouldDisplayErrors()
124 {
125 if($this->isHHVM())
126 {
127 return (bool)ini_get('hhvm.debug.server_error_message');
128 }
129 else
130 {
131 return (bool)ini_get('display_errors');
132 }
133 }
134}
__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 ...
getReportedErrorLevels()
isPHP()
Returns true when the runtime used is PHP.
isHHVM()
Returns true when the runtime used is HHVM.
static getInstance()
static $instance