ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilRuntime Class Reference
+ Inheritance diagram for ilRuntime:
+ Collaboration diagram for ilRuntime:

Public Member Functions

 isHHVM ()
 
 isPHP ()
 
 isFPM ()
 
 getVersion ()
 
 getName ()
 
 __toString ()
 
 getReportedErrorLevels ()
 
 shouldLogErrors ()
 
 shouldDisplayErrors ()
 
 getBinary ()
 

Static Public Member Functions

static getInstance ()
 

Private Member Functions

 __construct ()
 The runtime is a constant state during one request, so please use the public static getInstance() to instantiate the runtime. More...
 

Static Private Attributes

static self $instance = null
 

Detailed Description

Definition at line 21 of file class.ilRuntime.php.

Constructor & Destructor Documentation

◆ __construct()

ilRuntime::__construct ( )
private

The runtime is a constant state during one request, so please use the public static getInstance() to instantiate the runtime.

Definition at line 28 of file class.ilRuntime.php.

29 {
30 }

Member Function Documentation

◆ __toString()

ilRuntime::__toString ( )

Definition at line 74 of file class.ilRuntime.php.

74 : string
75 {
76 return $this->getName() . ' ' . $this->getVersion();
77 }

References getName(), and getVersion().

+ Here is the call graph for this function:

◆ getBinary()

ilRuntime::getBinary ( )

Definition at line 106 of file class.ilRuntime.php.

106 : string
107 {
108 if (defined('PHP_BINARY') && PHP_BINARY !== '') {
109 return escapeshellarg(PHP_BINARY);
110 }
111
112 $possibleBinaryLocations = [
113 PHP_BINDIR . '/php',
114 PHP_BINDIR . '/php-cli.exe',
115 PHP_BINDIR . '/php.exe',
116 ];
117
118 foreach ($possibleBinaryLocations as $binary) {
119 if (is_readable($binary)) {
120 return escapeshellarg($binary);
121 }
122 }
123
124 return 'php';
125 }

◆ getInstance()

static ilRuntime::getInstance ( )
static

Definition at line 32 of file class.ilRuntime.php.

32 : self
33 {
34 if (self::$instance === null) {
35 self::$instance = new self();
36 }
37
38 return self::$instance;
39 }
static self $instance

References $instance.

Referenced by ILIAS\FileDelivery\Delivery\detemineDeliveryType(), ilErrorHandling\getIlRuntime(), RunTimeTest\testBinaryCanBeRetrieved(), RunTimeTest\testGetNameReturnsPhpWhenRunningOnPhp(), and RunTimeTest\testGetVersionReturnsPhpVersionWhenRunningPhp().

+ Here is the caller graph for this function:

◆ getName()

ilRuntime::getName ( )

Definition at line 65 of file class.ilRuntime.php.

65 : string
66 {
67 if ($this->isHHVM()) {
68 return 'HHVM';
69 }
70
71 return 'PHP';
72 }

References isHHVM().

Referenced by __toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReportedErrorLevels()

ilRuntime::getReportedErrorLevels ( )

Definition at line 79 of file class.ilRuntime.php.

79 : int
80 {
81 if ($this->isHHVM()) {
82 return (int) ini_get('hhvm.log.runtime_error_reporting_level');
83 }
84
85 return (int) ini_get('error_reporting');
86 }

References isHHVM().

+ Here is the call graph for this function:

◆ getVersion()

ilRuntime::getVersion ( )

Definition at line 56 of file class.ilRuntime.php.

56 : string
57 {
58 if ($this->isHHVM()) {
59 return HHVM_VERSION;
60 }
61
62 return PHP_VERSION;
63 }

References isHHVM().

Referenced by __toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFPM()

ilRuntime::isFPM ( )

Definition at line 51 of file class.ilRuntime.php.

51 : bool
52 {
53 return PHP_SAPI === 'fpm-fcgi';
54 }

◆ isHHVM()

ilRuntime::isHHVM ( )

Definition at line 41 of file class.ilRuntime.php.

41 : bool
42 {
43 return defined('HHVM_VERSION');
44 }

Referenced by getName(), getReportedErrorLevels(), getVersion(), isPHP(), shouldDisplayErrors(), and shouldLogErrors().

+ Here is the caller graph for this function:

◆ isPHP()

ilRuntime::isPHP ( )

Definition at line 46 of file class.ilRuntime.php.

46 : bool
47 {
48 return !$this->isHHVM();
49 }

References isHHVM().

+ Here is the call graph for this function:

◆ shouldDisplayErrors()

ilRuntime::shouldDisplayErrors ( )

Definition at line 97 of file class.ilRuntime.php.

97 : bool
98 {
99 if ($this->isHHVM()) {
100 return (bool) ini_get('hhvm.debug.server_error_message');
101 }
102
103 return (bool) ini_get('display_errors');
104 }

References isHHVM().

+ Here is the call graph for this function:

◆ shouldLogErrors()

ilRuntime::shouldLogErrors ( )

Definition at line 88 of file class.ilRuntime.php.

88 : bool
89 {
90 if ($this->isHHVM()) {
91 return (bool) ini_get('hhvm.log.use_log_file');
92 }
93
94 return (bool) ini_get('log_errors');
95 }

References isHHVM().

+ Here is the call graph for this function:

Field Documentation

◆ $instance

self ilRuntime::$instance = null
staticprivate

Definition at line 23 of file class.ilRuntime.php.

Referenced by getInstance().


The documentation for this class was generated from the following file: