Small refactoring and documentation fix

This commit is contained in:
Stéphane Goetz 2017-11-07 23:17:05 +01:00
parent def4b5ed98
commit 837fca6886
3 changed files with 18 additions and 11 deletions

View File

@ -6,7 +6,7 @@
[![Build Status](https://img.shields.io/travis/dauxio/daux.io/master.svg?style=flat-square)](https://travis-ci.org/dauxio/daux.io)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io)
[![Total Downloads](https://img.shields.io/packagist/dt/dauxio/daux.io.svg?style=flat-square)](https://packagist.org/packages/dauxio/daux.io)
[![Total Downloads](https://img.shields.io/packagist/dt/daux/daux.io.svg?style=flat-square)](https://packagist.org/packages/daux/daux.io)
**Daux.io** is a documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way.

View File

@ -72,7 +72,7 @@ class Daux
// Read command line overrides
$override_file = $this->getConfigurationOverride($override_file);
if ($override_file != null) {
if ($override_file !== null) {
$params->setConfigurationOverrideFile($override_file);
$this->loadConfiguration($override_file);
}

View File

@ -469,11 +469,19 @@ class DauxHelper
return '' !== $parts['root'];
}
public static function getAbsolutePath($path) {
if (DauxHelper::isAbsolutePath($path)) {
return $path;
}
return getcwd() . '/' . $path;
}
/**
* @param $path
* @param $basedir
* @param $var
* @param $type
* @param string|null $path
* @param string $basedir
* @param string $var The constant name to check
* @param "dir"|"file" $type
* @return false|null|string
*/
public static function findLocation($path, $basedir, $var, $type) {
@ -483,18 +491,17 @@ class DauxHelper
return $env;
}
// If Path is explicitly null, it's useless to go further
if ($path == null) {
return null;
}
// Check if it's relative to the current directory or an absolute path
if (DauxHelper::is($path, $type)) {
if (DauxHelper::isAbsolutePath($path)) {
return $path;
}
return getcwd() . '/' . $path;
return DauxHelper::getAbsolutePath($path);
}
// Check if it exists relative to Daux's root
$newPath = $basedir . DIRECTORY_SEPARATOR . $path;
if (DauxHelper::is($newPath, $type)) {
return $newPath;