33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6+ declare (strict_types=1 );
7+
68namespace Magento \Developer \Model \Logger \Handler ;
79
10+ use Exception ;
811use Magento \Config \Setup \ConfigOptionsList ;
9- use Magento \Framework \App \Config \ ScopeConfigInterface ;
12+ use Magento \Framework \App \DeploymentConfig ;
1013use Magento \Framework \App \State ;
14+ use Magento \Framework \Exception \FileSystemException ;
15+ use Magento \Framework \Exception \RuntimeException ;
1116use Magento \Framework \Filesystem \DriverInterface ;
12- use Magento \Framework \App \ DeploymentConfig ;
17+ use Magento \Framework \Logger \ Handler \ Debug as DebugHandler ;
1318
1419/**
1520 * Enable/disable debug logging based on the store config setting
1621 */
17- class Debug extends \ Magento \ Framework \ Logger \ Handler \Debug
22+ class Debug extends DebugHandler
1823{
1924 /**
2025 * @var State
@@ -30,14 +35,14 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug
3035 * @param DriverInterface $filesystem
3136 * @param State $state
3237 * @param DeploymentConfig $deploymentConfig
33- * @param string $filePath
34- * @throws \ Exception
38+ * @param string|null $filePath
39+ * @throws Exception
3540 */
3641 public function __construct (
3742 DriverInterface $ filesystem ,
3843 State $ state ,
3944 DeploymentConfig $ deploymentConfig ,
40- $ filePath = null
45+ ? string $ filePath = null
4146 ) {
4247 parent ::__construct ($ filesystem , $ filePath );
4348
@@ -48,30 +53,34 @@ public function __construct(
4853 /**
4954 * @inheritdoc
5055 */
51- public function isHandling (array $ record )
56+ public function isHandling (array $ record ): bool
5257 {
5358 if ($ this ->deploymentConfig ->isAvailable ()) {
54- return
55- parent ::isHandling ($ record )
56- && $ this ->isLoggingEnabled ();
59+ return parent ::isHandling ($ record ) && $ this ->isLoggingEnabled ();
5760 }
5861
5962 return parent ::isHandling ($ record );
6063 }
6164
6265 /**
63- * Check that logging functionality is enabled.
66+ * Check that logging functionality is enabled
6467 *
6568 * @return bool
69+ * @throws FileSystemException
70+ * @throws RuntimeException
6671 */
6772 private function isLoggingEnabled (): bool
6873 {
69- $ configValue = $ this ->deploymentConfig ->get (ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING );
74+ $ configValue = $ this ->deploymentConfig ->get (
75+ ConfigOptionsList::CONFIG_PATH_DEBUG_LOGGING
76+ );
77+
7078 if ($ configValue === null ) {
7179 $ isEnabled = $ this ->state ->getMode () !== State::MODE_PRODUCTION ;
7280 } else {
73- $ isEnabled = (bool )$ configValue ;
81+ $ isEnabled = (bool ) $ configValue ;
7482 }
83+
7584 return $ isEnabled ;
7685 }
7786}
0 commit comments