Conditions | 5 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function __construct(LoggerInterface $logger = null) |
||
14 | { |
||
15 | $this->logger = $logger; |
||
|
|||
16 | |||
17 | // determine whether to use OpenSSL |
||
18 | if (defined('PHP_WINDOWS_VERSION_BUILD') && version_compare(PHP_VERSION, '5.3.4', '<')) { |
||
19 | $this->useOpenSsl = false; |
||
20 | } elseif (!function_exists('openssl_random_pseudo_bytes')) { |
||
21 | if (null !== $this->logger) { |
||
22 | $this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.'); |
||
23 | } |
||
24 | $this->useOpenSsl = false; |
||
25 | } else { |
||
26 | $this->useOpenSsl = true; |
||
27 | } |
||
28 | } |
||
29 | |||
54 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: