New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileDebugMode #4
Conversation
src/ExtraConfigurator.php
Outdated
@@ -15,9 +14,6 @@ class ExtraConfigurator extends Configurator | |||
public function __construct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty constructor?
export NETTE__DATABASE__HOST=localhost | ||
```php | ||
$configurator = new ExtraConfigurator(); | ||
$configurator->setEnvDebugMode(); | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TRUE; -> TRUE.
*/ | ||
public static function setup(Configurator $configurator) | ||
public function setFileDebugMode($fileName = NULL) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice. What about little tunning?
function setFileDebugMode($fileName = null)
{
$appDir = $this->parameters['appDir'] ? $this->parameters['appDir'] : null;
// No filename and no application root dir
if (!$fileName && !$appDir) return;
$content = @file_get_contents($fileName ?: $appDir . '/../.debug');
// Not exists or not readable
if ($content === false) return;
if (empty($content)) {
$this->setDebugMode(true);
} else {
$debug = self::parseDebugValue(trim($content));
$this->setDebugMode($debug);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@f3l1x seems fine besides empty($content)
cant be used cause its invalid for "0" etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, $content === ''
would be fine.
d497a5c
to
1e397fa
Compare
Najs. |
No description provided.