8
0
Fork 0

Fix bugs reported by scrutinizer

Dieser Commit ist enthalten in:
Stéphane Goetz 2016-07-29 22:38:03 +02:00
Ursprung fb5fb41e96
Commit 948f2aaa39
12 geänderte Dateien mit 66 neuen und 48 gelöschten Zeilen

Datei anzeigen

@ -77,8 +77,10 @@ function createLinter() {
var style_tasks = [];
for (var style in resources) {
gulp.task('style_' + style, createTask(resources[style].source, resources[style].dest));
style_tasks.push('style_' + style);
if (resources.hasOwnProperty(style)) {
gulp.task('style_' + style, createTask(resources[style].source, resources[style].dest));
style_tasks.push('style_' + style);
}
}
gulp.task('lint-css', createLinter);

Datei anzeigen

@ -357,7 +357,7 @@ class Daux
*/
public function getContentExtensions()
{
if ($this->validExtensions) {
if (!empty($this->validExtensions)) {
return $this->validExtensions;
}

Datei anzeigen

@ -2,6 +2,7 @@
use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\RequestException;
class Api
{
@ -42,7 +43,7 @@ class Api
* this will give little bit more sense to it and return it
*
* @param BadResponseException $e
* @return BadResponseException
* @return RequestException
*/
protected function handleError(BadResponseException $e)
{

Datei anzeigen

@ -15,6 +15,10 @@ class ImageRenderer extends \League\CommonMark\Inline\Renderer\ImageRenderer
*/
public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
{
if (!($inline instanceof Image)) {
throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline));
}
// External Images need special handling
if (strpos($inline->getUrl(), 'http') === 0) {
return new HtmlElement(

Datei anzeigen

@ -1,5 +1,5 @@
<?php namespace Todaymade\Daux\Format\Confluence;
class DuplicateTitleException extends \RuntimeException
class DuplicateTitleException extends \GuzzleHttp\Exception\RequestException
{
}

Datei anzeigen

@ -164,8 +164,11 @@ class Processor implements DocumentProcessorInterface
$a = new Link('#' . $entry->getId());
foreach ($this->cloneChildren($entry->getContent()) as $node) {
$a->appendChild($node);
$children = $entry->getChildren();
if ($children != null) {
foreach ($this->cloneChildren($entry->getContent()) as $node) {
$a->appendChild($node);
}
}
$p = new Paragraph();

Datei anzeigen

@ -167,7 +167,7 @@ class Builder
/**
* @param Directory $parent
* @param string $path
* @return Content
* @return ContentAbstract
*/
public static function getOrCreatePage(Directory $parent, $path)
{

Datei anzeigen

@ -1,23 +1,5 @@
<?php namespace Todaymade\Daux\Tree;
class ComputedRaw extends Entry
class ComputedRaw extends ContentAbstract
{
/** @var string */
protected $content;
/**
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* @param string $content
*/
public function setContent($content)
{
$this->content = $content;
}
}

Datei anzeigen

@ -2,7 +2,7 @@
use Webuni\FrontMatter\FrontMatter;
class Content extends Entry
class Content extends ContentAbstract
{
/** @var string */
protected $content;

Datei anzeigen

@ -0,0 +1,24 @@
<?php namespace Todaymade\Daux\Tree;
abstract class ContentAbstract extends Entry
{
/** @var string */
protected $content;
/**
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* @param string $content
*/
public function setContent($content)
{
$this->content = $content;
}
}

Datei anzeigen

Datei anzeigen

@ -1,12 +1,12 @@
_ = {};
/** global localStorage */
var _ = {};
_.now = Date.now || function() {
return new Date().getTime();
};
_.debounce = function(func, wait, immediate) {
var timeout, args, context, timestamp, result;
var timeout, args, context, timestamp;
var later = function() {
var last = _.now() - timestamp;
@ -16,8 +16,10 @@ _.debounce = function(func, wait, immediate) {
} else {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
func.apply(context, args);
if (!timeout) {
context = args = null;
}
}
}
};
@ -27,13 +29,15 @@ _.debounce = function(func, wait, immediate) {
args = arguments;
timestamp = _.now();
var callNow = immediate && !timeout;
if (!timeout) timeout = setTimeout(later, wait);
if (!timeout) {
timeout = setTimeout(later, wait);
}
if (callNow) {
result = func.apply(context, args);
func.apply(context, args);
context = args = null;
}
return result;
return true;
};
};
@ -61,15 +65,11 @@ $(function () {
toggleCodeBlockBtns.removeClass("Button--active");
console.log("Toggle", codeBlockState);
switch (codeBlockState) {
default:
case 0: // Hidden code blocks
toggleCodeBlockBtnHide.addClass("Button--active");
toggleCodeBlockBtn.html("Show Code Blocks");
codeBlockView.removeClass('Columns__right--float');
codeBlocks.addClass('hidden');
case 2: // Show code blocks inline
toggleCodeBlockBtnFloat.addClass("Button--active");
codeBlockView.addClass('Columns__right--float');
codeBlocks.removeClass('hidden');
break;
case 1: // Show code blocks below
toggleCodeBlockBtnBelow.addClass("Button--active");
@ -77,10 +77,12 @@ $(function () {
codeBlockView.removeClass('Columns__right--float');
codeBlocks.removeClass('hidden');
break;
case 2: // Show code blocks inline
toggleCodeBlockBtnFloat.addClass("Button--active");
codeBlockView.addClass('Columns__right--float');
codeBlocks.removeClass('hidden');
case 0: // Hidden code blocks
default:
toggleCodeBlockBtnHide.addClass("Button--active");
toggleCodeBlockBtn.html("Show Code Blocks");
codeBlockView.removeClass('Columns__right--float');
codeBlocks.addClass('hidden');
break;
}
}