Skip to content

Commit 2314516

Browse files
committed
Applied fixes from StyleCI
1 parent cfc8d30 commit 2314516

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+477
-424
lines changed

daux/Processor.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
use Todaymade\Daux\Tree\Root;
44

5-
class Processor extends \Todaymade\Daux\Processor {
6-
5+
class Processor extends \Todaymade\Daux\Processor
6+
{
77
public function manipulateTree(Root $root)
88
{
99
print_r($root->dump());

index.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@
7676
}
7777

7878
if (file_exists('vendor/autoload.php')) {
79-
require_once('vendor/autoload.php');
79+
require_once 'vendor/autoload.php';
8080
} elseif (file_exists('daux.phar')) {
8181
define('PHAR_DIR', __DIR__);
82-
require_once("phar://" . __DIR__ . "/daux.phar/vendor/autoload.php");
82+
require_once 'phar://' . __DIR__ . '/daux.phar/vendor/autoload.php';
8383
} else {
84-
throw new Exception("Impossible to load Daux, missing vendor/ or daux.phar");
84+
throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar');
8585
}
8686

8787
\Todaymade\Daux\Server\Server::serve($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $_REQUEST);

libs/Compiler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private function stripWhitespace($source)
141141
foreach (token_get_all($source) as $token) {
142142
if (is_string($token)) {
143143
$output .= $token;
144-
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
144+
} elseif (in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) {
145145
$output .= str_repeat("\n", substr_count($token[1], "\n"));
146146
} elseif (T_WHITESPACE === $token[0]) {
147147
// reduce wide spaces

libs/Console/RunAction.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ protected function runAction($title, OutputInterface $output, $width, \Closure $
88
{
99
$output->write($title);
1010

11-
$length = function_exists("mb_strlen")? mb_strlen($title) : strlen($title);
11+
$length = function_exists('mb_strlen') ? mb_strlen($title) : strlen($title);
1212

1313
// 8 is the length of the label + 2 let it breathe
1414
$padding = $width - $length - 10;
1515
try {
1616
$response = $closure();
1717
} catch (\Exception $e) {
18-
$output->writeln(str_pad(" ", $padding) . "[ <fg=red>FAIL</fg=red> ]");
18+
$output->writeln(str_pad(' ', $padding) . '[ <fg=red>FAIL</fg=red> ]');
1919
throw $e;
2020
}
21-
$output->writeln(str_pad(" ", $padding) . "[ <fg=green>OK</fg=green> ]");
21+
$output->writeln(str_pad(' ', $padding) . '[ <fg=green>OK</fg=green> ]');
2222

2323
return $response;
2424
}

libs/ContentTypes/ContentTypeHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class ContentTypeHandler
66
{
77
/**
8-
* @var ContentType[] $types
8+
* @var ContentType[]
99
*/
1010
protected $types;
1111

libs/ContentTypes/Markdown/CommonMarkConverter.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
use League\CommonMark\Environment;
55
use League\CommonMark\HtmlRenderer;
66
use Todaymade\Daux\Config;
7-
use Todaymade\Daux\ContentTypes\Markdown\TOC\Parser;
8-
use Todaymade\Daux\ContentTypes\Markdown\TOC\Renderer;
9-
use Todaymade\Daux\ContentTypes\Markdown\TOC\TOCProcessor;
107
use Webuni\CommonMark\TableExtension\TableExtension;
118

129
class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
@@ -16,7 +13,7 @@ class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
1613
*
1714
* @param array $config
1815
*/
19-
public function __construct(array $config = array())
16+
public function __construct(array $config = [])
2017
{
2118
$environment = Environment::createCommonMarkEnvironment();
2219
$environment->mergeConfig($config);

libs/ContentTypes/Markdown/ContentType.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function getExtensions()
2828
public function convert($raw, Content $node)
2929
{
3030
$this->config->setCurrentPage($node);
31+
3132
return $this->converter->convertToHtml($raw);
3233
}
3334
}

libs/ContentTypes/Markdown/LinkRenderer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function resolveInternalFile($url)
3434
// "!" In this case we will try to find
3535
// the file starting at the root
3636
if ($url[0] == '!' || $url[0] == '/') {
37-
$url = ltrim($url, "!/");
37+
$url = ltrim($url, '!/');
3838

3939
if ($file = DauxHelper::getFile($this->daux['tree'], $url)) {
4040
return $file;
@@ -71,7 +71,7 @@ public function render(AbstractInline $inline, ElementRendererInterface $htmlRen
7171
// have the same interface
7272
if (!$inline instanceof Link) {
7373
throw new \RuntimeException(
74-
"Wrong type passed to " . __CLASS__ . "::" . __METHOD__ .
74+
'Wrong type passed to ' . __CLASS__ . '::' . __METHOD__ .
7575
" the expected type was 'League\\CommonMark\\Inline\\Element\\Link' but '" .
7676
get_class($inline) . "' was provided"
7777
);
@@ -83,7 +83,7 @@ public function render(AbstractInline $inline, ElementRendererInterface $htmlRen
8383

8484
// Absolute urls, empty urls and anchors
8585
// should not go through the url resolver
86-
if (empty($url) || $url[0] == "#" || preg_match("|^(?:[a-z]+:)?//|", $url)) {
86+
if (empty($url) || $url[0] == '#' || preg_match('|^(?:[a-z]+:)?//|', $url)) {
8787
return $element;
8888
}
8989

libs/ContentTypes/Markdown/TableOfContents.php

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
class TableOfContents extends AbstractBlock
77
{
8-
98
/**
109
* Returns true if this block can contain the given block as a child node
1110
*

libs/ContentTypes/Markdown/TableOfContentsParser.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class TableOfContentsParser extends AbstractBlockParser
88
{
9-
109
/**
1110
* @param ContextInterface $context
1211
* @param Cursor $cursor

libs/Daux.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected function loadBaseConfiguration()
131131
// Set the default configuration
132132
$this->options->merge([
133133
'docs_directory' => 'docs',
134-
'valid_content_extensions' => ['md', 'markdown']
134+
'valid_content_extensions' => ['md', 'markdown'],
135135
]);
136136

137137
// Load the global configuration
@@ -228,7 +228,7 @@ public function getParams()
228228
'local_base' => $this->local_base,
229229
'docs_path' => $this->docs_path,
230230
'themes_path' => $this->themes_path,
231-
'templates' => 'templates'
231+
'templates' => 'templates',
232232
];
233233
$this->options->conservativeMerge($default);
234234

@@ -301,12 +301,12 @@ public function getProcessorClass()
301301
return null;
302302
}
303303

304-
$class = "\\Todaymade\\Daux\\Extension\\" . $processor;
304+
$class = '\\Todaymade\\Daux\\Extension\\' . $processor;
305305
if (!class_exists($class)) {
306306
throw new \RuntimeException("Class '$class' not found. We cannot use it as a Processor");
307307
}
308308

309-
if (!array_key_exists("Todaymade\\Daux\\Processor", class_parents($class))) {
309+
if (!array_key_exists('Todaymade\\Daux\\Processor', class_parents($class))) {
310310
throw new \RuntimeException("Class '$class' invalid, should extend '\\Todaymade\\Daux\\Processor'");
311311
}
312312

0 commit comments

Comments
 (0)