for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) 2015 Nobuo Kihara
* @license https://github.com/softark/creole/blob/master/LICENSE
* @link https://github.com/softark/creole#readme
*/
namespace softark\creole\block;
* Adds horizontal rules
trait RuleTrait
{
* identify a line as a horizontal rule.
* The exact string of '----', with possible white spaces before and/or after it
protected function identifyHr($line)
return preg_match('/^\s*----\s*$/', $line);
}
* Consume a horizontal rule
protected function consumeHr($lines, $current)
$lines
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
return [['hr'], $current];
* Renders a horizontal rule
protected function renderHr($block)
$block
return $this->html5 ? "<hr>\n" : "<hr />\n";
html5
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.