1
0
mirror of https://github.com/themsaid/ibis.git synced 2025-01-17 05:28:32 +01:00

style fix

This commit is contained in:
Mohamed Said 2020-11-05 09:00:25 +02:00
parent b5d3957a2f
commit da37bdb929
8 changed files with 89 additions and 34 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
bin/
vendor/
.php_cs.cache
.DS_Store
/.idea

51
.php_cs Normal file
View File

@ -0,0 +1,51 @@
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_quote' => true,
'binary_operator_spaces' => array(
'default' => 'single_space',
),
'blank_line_after_opening_tag' => true,
'braces' => array(
'allow_single_line_closure' => true,
),
'concat_space' => array('spacing' => 'none'),
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'include' => true,
'lowercase_cast' => true,
'no_extra_consecutive_blank_lines' => array(
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'throw',
'use',
),
'ordered_imports' => [
'sort_algorithm' => 'length'
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_spaces_around_offset' => true,
'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'single_blank_line_before_namespace' => true,
'ternary_operator_spaces' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'not_operator_with_successor_space' => true,
))
//->setIndent("\t")
->setLineEnding("\n")
;

View File

@ -37,6 +37,11 @@
"sort-packages": true,
"optimize-autoloader": true
},
"scripts": {
"csfix": [
"php-cs-fixer fix src stubs --config=.php_cs"
]
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -3,19 +3,19 @@
namespace Ibis\Commands;
use Ibis\Ibis;
use Illuminate\Filesystem\Filesystem;
use League\CommonMark\Block\Element\FencedCode;
use League\CommonMark\Environment;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Mpdf\Config\ConfigVariables;
use Mpdf\Config\FontVariables;
use Mpdf\Mpdf;
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
use SplFileInfo;
use Mpdf\Config\FontVariables;
use Mpdf\Config\ConfigVariables;
use League\CommonMark\Environment;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Command\Command;
use League\CommonMark\Block\Element\FencedCode;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
use Symfony\Component\Console\Output\OutputInterface;
use League\CommonMark\GithubFlavoredMarkdownConverter;
class BuildCommand extends Command
{
@ -92,7 +92,9 @@ class BuildCommand extends Command
if (! $this->disk->isDirectory($currentPath.'/export')) {
$this->disk->makeDirectory(
$currentPath.'/export', 0755, true
$currentPath.'/export',
0755,
true
);
}
}
@ -181,7 +183,6 @@ class BuildCommand extends Command
'margin_top' => 14,
'fontDir' => array_merge($fontDirs, [getcwd().'/assets/fonts']),
'fontdata' => $this->fonts($config, $fontData),
]);
$pdf->SetTitle(Ibis::title());
@ -206,7 +207,8 @@ class BuildCommand extends Command
} else {
$this->output->writeln('<fg=yellow>==></> Adding Book Cover ...');
$pdf->WriteHTML(<<<HTML
$pdf->WriteHTML(
<<<HTML
<div style="position: absolute; left:0; right: 0; top: -.2; bottom: 0;">
<img src="assets/cover.jpg" style="width: 210mm; height: 297mm; margin: 0;"/>
</div>
@ -252,11 +254,11 @@ HTML
protected function fonts($config, $fontData)
{
return $fontData + collect($config['fonts'])->mapWithKeys(function ($file, $name) {
return [
$name => [
'R' => $file
]
];
})->toArray();
return [
$name => [
'R' => $file
]
];
})->toArray();
}
}

View File

@ -66,19 +66,23 @@ class InitCommand extends Command
$currentPath.'/content'
);
$this->disk->put($currentPath.'/ibis.php',
$this->disk->put(
$currentPath.'/ibis.php',
$this->disk->get(__DIR__.'/../../stubs/ibis.php')
);
$this->disk->put($currentPath.'/assets/cover.jpg',
$this->disk->put(
$currentPath.'/assets/cover.jpg',
$this->disk->get(__DIR__.'/../../stubs/assets/cover.jpg')
);
$this->disk->put($currentPath.'/assets/theme-dark.html',
$this->disk->put(
$currentPath.'/assets/theme-dark.html',
$this->disk->get(__DIR__.'/../../stubs/assets/theme-dark.html')
);
$this->disk->put($currentPath.'/assets/theme-light.html',
$this->disk->put(
$currentPath.'/assets/theme-light.html',
$this->disk->get(__DIR__.'/../../stubs/assets/theme-light.html')
);

View File

@ -2,17 +2,8 @@
namespace Ibis\Commands;
use Ibis\Ibis;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Str;
use League\CommonMark\Block\Element\FencedCode;
use League\CommonMark\Environment;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Mpdf\Config\ConfigVariables;
use Mpdf\Config\FontVariables;
use Mpdf\Mpdf;
use Spatie\CommonMarkHighlighter\FencedCodeRenderer;
use SplFileInfo;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

View File

@ -48,4 +48,4 @@ class Ibis
return static::$config;
}
}
}

View File

@ -6,7 +6,6 @@ return [
*/
'title' => 'The Ocean at the End of the Lane',
/**
* The author name.
*/
@ -16,8 +15,8 @@ return [
* The list of fonts to be used in the different themes.
*/
'fonts' => [
// 'calibri' => 'Calibri-Regular.ttf',
// 'times' => 'times-regular.ttf',
// 'calibri' => 'Calibri-Regular.ttf',
// 'times' => 'times-regular.ttf',
],
/**