Fix formatting

This commit is contained in:
Stéphane Goetz 2018-05-05 18:16:24 +02:00
parent 1e23b4ed90
commit 65f0679d7a
9 changed files with 15 additions and 13 deletions

View File

@ -27,7 +27,7 @@ class DauxCommand extends SymfonyCommand
$keys = explode('.', $key); $keys = explode('.', $key);
while (count($keys) > 1) { while (count($keys) > 1) {
$key = array_shift($keys); $key = array_shift($keys);
if (! isset($array[$key]) || ! is_array($array[$key])) { if (!isset($array[$key]) || !is_array($array[$key])) {
$array[$key] = []; $array[$key] = [];
} }
$array = &$array[$key]; $array = &$array[$key];
@ -39,7 +39,7 @@ class DauxCommand extends SymfonyCommand
private function applyConfiguration(array $options, Daux $daux) private function applyConfiguration(array $options, Daux $daux)
{ {
$values = array_map( $values = array_map(
function ($value) { function($value) {
return array_map("trim", explode('=', $value)); return array_map("trim", explode('=', $value));
}, },
$options $options

View File

@ -40,7 +40,7 @@ class Serve extends DauxCommand
putenv('DAUX_SOURCE=' . $daux->getParams()->getDocumentationDirectory()); putenv('DAUX_SOURCE=' . $daux->getParams()->getDocumentationDirectory());
putenv('DAUX_THEME=' . $daux->getParams()->getThemesPath()); putenv('DAUX_THEME=' . $daux->getParams()->getThemesPath());
putenv('DAUX_CONFIGURATION=' . $daux->getParams()->getConfigurationOverrideFile()); putenv('DAUX_CONFIGURATION=' . $daux->getParams()->getConfigurationOverrideFile());
putenv('DAUX_EXTENSION=' . DAUX_EXTENSION); putenv('DAUX_EXTENSION=' . DAUX_EXTENSION);
$base = ProcessUtils::escapeArgument(__DIR__ . '/../../'); $base = ProcessUtils::escapeArgument(__DIR__ . '/../../');
$binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));

View File

@ -25,7 +25,7 @@ class EmbedImages
{ {
return preg_replace_callback( return preg_replace_callback(
"/<img\\s+[^>]*src=['\"]([^\"]*)['\"][^>]*>/", "/<img\\s+[^>]*src=['\"]([^\"]*)['\"][^>]*>/",
function ($matches) use ($file, $callback) { function($matches) use ($file, $callback) {
if ($result = $this->findImage($matches[1], $matches[0], $file, $callback)) { if ($result = $this->findImage($matches[1], $matches[0], $file, $callback)) {
return $result; return $result;
} }

View File

@ -19,7 +19,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
->embed( ->embed(
$content, $content,
$this->file, $this->file,
function ($src, array $attributes, Entry $file) { function($src, array $attributes, Entry $file) {
//Add the attachment for later upload //Add the attachment for later upload
if ($file instanceof Raw) { if ($file instanceof Raw) {

View File

@ -81,7 +81,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
'Generating Tree ...', 'Generating Tree ...',
$output, $output,
$width, $width,
function () use ($params) { function() use ($params) {
$tree = $this->generateRecursive($this->daux->tree, $params); $tree = $this->generateRecursive($this->daux->tree, $params);
$tree['title'] = $this->prefix . $params['title']; $tree['title'] = $this->prefix . $params['title'];

View File

@ -114,7 +114,7 @@ class Processor implements DocumentProcessorInterface
// If the node has an ID, no need to generate it, just check it's unique // If the node has an ID, no need to generate it, just check it's unique
$attributes = $node->getData('attributes', []); $attributes = $node->getData('attributes', []);
if (array_key_exists('id', $attributes) && !empty($attributes['id'])) { if (array_key_exists('id', $attributes) && !empty($attributes['id'])) {
$node->data['attributes']['id'] = $this->getUniqueId($document, $attributes['id']); $node->data['attributes']['id'] = $this->getUniqueId($document, $attributes['id']);
return; return;
} }
@ -139,7 +139,7 @@ class Processor implements DocumentProcessorInterface
} }
} }
$node->data['attributes']['id'] = $this->getUniqueId($document,'page_'. $this->escaped($text)); $node->data['attributes']['id'] = $this->getUniqueId($document,'page_'. $this->escaped($text));
} }
/** /**

View File

@ -82,7 +82,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator
'Copying Static assets ...', 'Copying Static assets ...',
$output, $output,
$width, $width,
function () use ($destination, $params) { function() use ($destination, $params) {
$this->ensureEmptyDestination($destination); $this->ensureEmptyDestination($destination);
$this->copyThemes($destination, $params->getThemesPath()); $this->copyThemes($destination, $params->getThemesPath());
@ -196,7 +196,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator
'- ' . $node->getUrl(), '- ' . $node->getUrl(),
$output, $output,
$width, $width,
function () use ($node, $output_dir, $key, $params, $index_pages) { function() use ($node, $output_dir, $key, $params, $index_pages) {
if ($node instanceof Raw) { if ($node instanceof Raw) {
copy($node->getPath(), $output_dir . DIRECTORY_SEPARATOR . $key); copy($node->getPath(), $output_dir . DIRECTORY_SEPARATOR . $key);

View File

@ -17,7 +17,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
->embed( ->embed(
$content, $content,
$this->file, $this->file,
function ($src, array $attributes, Raw $file) { function($src, array $attributes, Raw $file) {
$content = base64_encode(file_get_contents($file->getPath())); $content = base64_encode(file_get_contents($file->getPath()));
$attr = ''; $attr = '';
foreach ($attributes as $name => $value) { foreach ($attributes as $name => $value) {

View File

@ -32,7 +32,9 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
continue; continue;
} }
if (!$name) continue; if (!$name) {
continue;
}
if ($name[0] == '-') { if ($name[0] == '-') {
if (is_numeric($name[1])) { if (is_numeric($name[1])) {
@ -82,7 +84,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
private function sortBucket($bucket, $final) private function sortBucket($bucket, $final)
{ {
uasort($bucket, function (Entry $a, Entry $b) { uasort($bucket, function(Entry $a, Entry $b) {
return strcasecmp($a->getName(), $b->getName()); return strcasecmp($a->getName(), $b->getName());
}); });