Skip to content

Commit

Permalink
coding style: fixed spaces & use statements order
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 11, 2017
1 parent 2d25b72 commit 849f78b
Show file tree
Hide file tree
Showing 40 changed files with 33 additions and 56 deletions.
1 change: 0 additions & 1 deletion src/Bridges/Latte/TexyMacro.php
Expand Up @@ -70,5 +70,4 @@ public function texyClosed(Latte\MacroNode $node)
$info[0] = $info[1];
}
}

}
2 changes: 0 additions & 2 deletions src/Texy/BlockParser.php
Expand Up @@ -164,8 +164,6 @@ public function parse($text)
} elseif (is_string($res)) {
$el->insert(NULL, $res);
}

} while (1);
}

}
1 change: 0 additions & 1 deletion src/Texy/Configurator.php
Expand Up @@ -96,5 +96,4 @@ public static function disableImages(Texy $texy)
unset($texy->allowedTags['img'], $texy->allowedTags['object'], $texy->allowedTags['embed'], $texy->allowedTags['applet']);
} // TODO: else...
}

}
1 change: 0 additions & 1 deletion src/Texy/HandlerInvocation.php
Expand Up @@ -84,5 +84,4 @@ public function getTexy()
public function free()
{
}

}
1 change: 0 additions & 1 deletion src/Texy/Helpers.php
Expand Up @@ -152,5 +152,4 @@ public static function prependRoot($URL, $root)
}
return rtrim($root, '/\\') . '/' . $URL;
}

}
1 change: 0 additions & 1 deletion src/Texy/HtmlElement.php
Expand Up @@ -578,5 +578,4 @@ final public function parseBlock(Texy $texy, $s, $indented = FALSE)
$parser = new BlockParser($texy, $this, $indented);
$parser->parse($s);
}

}
1 change: 0 additions & 1 deletion src/Texy/Image.php
Expand Up @@ -52,5 +52,4 @@ public function __clone()
$this->modifier = clone $this->modifier;
}
}

}
2 changes: 0 additions & 2 deletions src/Texy/LineParser.php
Expand Up @@ -138,10 +138,8 @@ public function parse($text)
$arrOffset[$min] = -1;
$offset += strlen($res);
}

} while (1);

$this->element->insert(NULL, $text);
}

}
1 change: 0 additions & 1 deletion src/Texy/Link.php
Expand Up @@ -54,5 +54,4 @@ public function __clone()
$this->modifier = clone $this->modifier;
}
}

}
23 changes: 14 additions & 9 deletions src/Texy/Modifier.php
Expand Up @@ -120,19 +120,26 @@ public function setProperties($mod)
$p = $a;

} elseif ($ch === '^') { // alignment
$this->vAlign = 'top'; $p++;
$this->vAlign = 'top';
$p++;
} elseif ($ch === '-') {
$this->vAlign = 'middle'; $p++;
$this->vAlign = 'middle';
$p++;
} elseif ($ch === '_') {
$this->vAlign = 'bottom'; $p++;
$this->vAlign = 'bottom';
$p++;
} elseif ($ch === '=') {
$this->hAlign = 'justify'; $p++;
$this->hAlign = 'justify';
$p++;
} elseif ($ch === '>') {
$this->hAlign = 'right'; $p++;
$this->hAlign = 'right';
$p++;
} elseif (substr($mod, $p, 2) === '<>') {
$this->hAlign = 'center'; $p+=2;
$this->hAlign = 'center';
$p+=2;
} elseif ($ch === '<') {
$this->hAlign = 'left'; $p++;
$this->hAlign = 'left';
$p++;
} else {
break;
}
Expand All @@ -151,7 +158,6 @@ public function decorate(Texy $texy, HtmlElement $el)
// tag & attibutes
$tmp = $texy->allowedTags; // speed-up
if (!$this->attrs) {

} elseif ($tmp === $texy::ALL) {
$elAttrs = $this->attrs;
$el->validateAttrs($texy->dtd);
Expand Down Expand Up @@ -235,5 +241,4 @@ public function decorate(Texy $texy, HtmlElement $el)

return $el;
}

}
1 change: 0 additions & 1 deletion src/Texy/Module.php
Expand Up @@ -17,5 +17,4 @@ abstract class Module

/** @var Texy */
protected $texy;

}
2 changes: 0 additions & 2 deletions src/Texy/Modules/BlockModule.php
Expand Up @@ -17,7 +17,6 @@
*/
final class BlockModule extends Texy\Module
{

public function __construct($texy)
{
$this->texy = $texy;
Expand Down Expand Up @@ -237,5 +236,4 @@ public function solve(Texy\HandlerInvocation $invocation, $blocktype, $s, $param

return FALSE;
}

}
2 changes: 0 additions & 2 deletions src/Texy/Modules/BlockQuoteModule.php
Expand Up @@ -15,7 +15,6 @@
*/
final class BlockQuoteModule extends Texy\Module
{

public function __construct($texy)
{
$this->texy = $texy;
Expand Down Expand Up @@ -130,5 +129,4 @@ public function citeLink($link)

return Texy\Helpers::prependRoot($link, $texy->linkModule->root);
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/EmoticonModule.php
Expand Up @@ -114,5 +114,4 @@ public function solve(Texy\HandlerInvocation $invocation, $emoticon, $raw)
$texy->summary['images'][] = $el->attrs['src'];
return $el;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/FigureModule.php
Expand Up @@ -122,5 +122,4 @@ public function solve(Texy\HandlerInvocation $invocation, Texy\Image $image, Tex

return $el;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/HeadingModule.php
Expand Up @@ -222,5 +222,4 @@ public function solve(Texy\HandlerInvocation $invocation, $level, $content, Modi

return $el;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/HorizLineModule.php
Expand Up @@ -67,5 +67,4 @@ public function solve(Texy\HandlerInvocation $invocation, $type, Texy\Modifier $

return $el;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/HtmlModule.php
Expand Up @@ -286,5 +286,4 @@ public function solveComment(Texy\HandlerInvocation $invocation, $content)

return $this->texy->protect('<!--' . $content . '-->', Texy\Texy::CONTENT_MARKUP);
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/HtmlOutputModule.php
Expand Up @@ -331,5 +331,4 @@ public function wrap($m)
list(, $space, $s) = $m;
return $space . wordwrap($s, $this->lineWrap, "\n" . $space);
}

}
3 changes: 1 addition & 2 deletions src/Texy/Modules/ImageModule.php
Expand Up @@ -8,8 +8,8 @@
namespace Texy\Modules;

use Texy;
use Texy\Image;
use Texy\Helpers;
use Texy\Image;
use Texy\Patterns;


Expand Down Expand Up @@ -306,5 +306,4 @@ public function solve(Texy\HandlerInvocation $invocation = NULL, Image $image, T

return $el;
}

}
2 changes: 0 additions & 2 deletions src/Texy/Modules/LinkModule.php
Expand Up @@ -386,7 +386,6 @@ private function textualUrl(Link $link)
}

if ($this->shorten && preg_match('#^(https?://|ftp://|www\.|/)#i', $link->raw)) {

$raw = strncasecmp($link->raw, 'www.', 4) === 0 ? 'none://' . $link->raw : $link->raw;

// parse_url() in PHP damages UTF-8 - use regular expression
Expand Down Expand Up @@ -417,5 +416,4 @@ private function textualUrl(Link $link)

return $link->raw;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/ListModule.php
Expand Up @@ -243,5 +243,4 @@ public function patternItem(BlockParser $parser, $bullet, $indented, $tag)

return $elItem;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/LongWordsModule.php
Expand Up @@ -219,5 +219,4 @@ public function pattern(array $matches)

return implode("\xC2\xAD", $syllables);
}

}
2 changes: 0 additions & 2 deletions src/Texy/Modules/ParagraphModule.php
Expand Up @@ -16,7 +16,6 @@
*/
final class ParagraphModule extends Texy\Module
{

public function __construct($texy)
{
$this->texy = $texy;
Expand Down Expand Up @@ -125,5 +124,4 @@ public function solve(Texy\HandlerInvocation $invocation, $content, Texy\Modifie

return $el;
}

}
2 changes: 0 additions & 2 deletions src/Texy/Modules/PhraseModule.php
Expand Up @@ -18,7 +18,6 @@
*/
final class PhraseModule extends Texy\Module
{

public $tags = [
'phrase/strong' => 'strong', // or 'b'
'phrase/em' => 'em', // or 'i'
Expand Down Expand Up @@ -341,5 +340,4 @@ public function solve(Texy\HandlerInvocation $invocation, $phrase, $content, Mod

return $el;
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/ScriptModule.php
Expand Up @@ -105,5 +105,4 @@ public function solve(Texy\HandlerInvocation $invocation, $cmd, array $args = NU
return FALSE;
}
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/TableCellElement.php
Expand Up @@ -23,5 +23,4 @@ class TableCellElement extends Texy\HtmlElement

/** @var string */
public $text;

}
1 change: 0 additions & 1 deletion src/Texy/Modules/TableModule.php
Expand Up @@ -284,5 +284,4 @@ private function finishPart(HtmlElement $elPart)
}
}
}

}
1 change: 0 additions & 1 deletion src/Texy/Modules/TypographyModule.php
Expand Up @@ -126,5 +126,4 @@ public function postLine($text, $preserveSpaces = FALSE)
}
return Texy\Regexp::replace($text, $this->pattern);
}

}
1 change: 0 additions & 1 deletion src/Texy/Parser.php
Expand Up @@ -32,5 +32,4 @@ public function getTexy()
{
return $this->texy;
}

}
1 change: 0 additions & 1 deletion src/Texy/Patterns.php
Expand Up @@ -42,5 +42,4 @@ class Patterns

// links, url - doesn't end by :).,!?
const LINK_URL = '(?:\[[^\]\n]++\]|(?=[\w/+.~%&?@=_\#$])[^\s\x14-\x1F]{0,1000}?[^:);,.!?\s\x14-\x1F])'; // any url - doesn't end by :).,!?
}
1 change: 0 additions & 1 deletion src/Texy/Regexp.php
Expand Up @@ -98,5 +98,4 @@ public static function replace($subject, $pattern, $replacement = NULL)
}
return $res;
}

}
1 change: 0 additions & 1 deletion src/Texy/Strict.php
Expand Up @@ -111,5 +111,4 @@ private static function getSuggestion(array $items, $value)
}
return $best;
}

}
1 change: 0 additions & 1 deletion src/Texy/Texy.php
Expand Up @@ -765,5 +765,4 @@ final public static function prependRoot($URL, $root)
final public function free()
{
}

}
2 changes: 1 addition & 1 deletion src/Texy/Utf.php
Expand Up @@ -68,6 +68,7 @@ public static function strtolower($s)

/** @deprecated */


public static function utf2ascii($s)
{
return Helpers::toAscii($s);
Expand Down Expand Up @@ -130,5 +131,4 @@ private static function cb($m)

return '';
}

}
17 changes: 13 additions & 4 deletions tests/Texy/Strict.phpt
Expand Up @@ -19,17 +19,26 @@ class TestClass

public static $publicStatic;


public function publicMethod()
{}
{
}


public static function publicMethodStatic()
{}
{
}


protected function protectedMethod()
{}
{
}


protected static function protectedMethodS()
{}
{
}


public function getBar()
{
Expand Down
1 change: 1 addition & 0 deletions tests/Texy/html-tags.phpt
Expand Up @@ -17,6 +17,7 @@ function createTexy()
return $texy;
}


$texy = createTexy();
Assert::matchFile(
__DIR__ . '/expected/html-tags1a.html',
Expand Down
1 change: 0 additions & 1 deletion tests/Texy/html5.phpt
Expand Up @@ -5,7 +5,6 @@
*/

use Tester\Assert;
use Texy\Configurator;
use Texy\Texy;

require __DIR__ . '/../bootstrap.php';
Expand Down
1 change: 1 addition & 0 deletions tests/Texy/links-images.phpt
Expand Up @@ -20,6 +20,7 @@ function createTexy()
return $texy;
}


$texy = createTexy();
Assert::matchFile(
__DIR__ . '/expected/links-images1.html',
Expand Down
2 changes: 2 additions & 0 deletions tests/Texy/user-images.phpt
Expand Up @@ -14,6 +14,7 @@ $texy->imageModule->root = '../images/';
$texy->imageModule->linkedRoot = '../images/big/';
$texy->htmlOutputModule->lineWrap = 180;


function imageHandler($invocation, $image, $link)
{
$texy = $invocation->getTexy();
Expand All @@ -28,6 +29,7 @@ function imageHandler($invocation, $image, $link)
return $invocation->proceed();
}


$texy->addHandler('image', 'imageHandler');

Assert::matchFile(
Expand Down

0 comments on commit 849f78b

Please sign in to comment.