Skip to content
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

Merged
merged 1 commit into from May 23, 2018
Merged

FileDebugMode #4

merged 1 commit into from May 23, 2018

Conversation

vody105
Copy link
Member

@vody105 vody105 commented May 22, 2018

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+4.7%) to 94.737% when pulling d497a5c on feature/file-debug-mode into ce35664 on master.

@@ -15,9 +14,6 @@ class ExtraConfigurator extends Configurator
public function __construct()
Copy link
Member

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();
```

Copy link
Member

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)
{
Copy link
Member

@f3l1x f3l1x May 22, 2018

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);
	}

}

Copy link
Member Author

@vody105 vody105 May 22, 2018

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

Copy link
Member

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.

@f3l1x f3l1x added this to the v0.3 milestone May 23, 2018
@f3l1x f3l1x merged commit 54989a6 into master May 23, 2018
@f3l1x f3l1x deleted the feature/file-debug-mode branch May 23, 2018 13:03
@f3l1x
Copy link
Member

f3l1x commented May 23, 2018

Najs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants