Completed
Pull Request — master (#56)
by David
05:43
created
lib/Dwoo/Plugins/Functions/PluginEval.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,26 +37,26 @@
 block discarded – undo
37 37
  */
38 38
 class PluginEval extends Plugin
39 39
 {
40
-    /**
41
-     * @param string $var
42
-     * @param null   $assign
43
-     *
44
-     * @return string
45
-     */
46
-    public function process($var, $assign = null)
47
-    {
48
-        if ($var == '') {
49
-            return '';
50
-        }
40
+	/**
41
+	 * @param string $var
42
+	 * @param null   $assign
43
+	 *
44
+	 * @return string
45
+	 */
46
+	public function process($var, $assign = null)
47
+	{
48
+		if ($var == '') {
49
+			return '';
50
+		}
51 51
 
52
-        $tpl   = new TemplateString($var);
53
-        $clone = clone $this->core;
54
-        $out   = $clone->get($tpl, $this->core->readVar('_parent'));
52
+		$tpl   = new TemplateString($var);
53
+		$clone = clone $this->core;
54
+		$out   = $clone->get($tpl, $this->core->readVar('_parent'));
55 55
 
56
-        if ($assign !== null) {
57
-            $this->core->assignInScope($out, $assign);
58
-        } else {
59
-            return $out;
60
-        }
61
-    }
56
+		if ($assign !== null) {
57
+			$this->core->assignInScope($out, $assign);
58
+		} else {
59
+			return $out;
60
+		}
61
+	}
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginTif.php 3 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -36,70 +36,70 @@
 block discarded – undo
36 36
  */
37 37
 class PluginTif extends Plugin implements ICompilable
38 38
 {
39
-    /**
40
-     * @param Compiler $compiler
41
-     * @param array    $rest
42
-     * @param array    $tokens
43
-     *
44
-     * @return mixed|string
45
-     * @throws CompilationException
46
-     */
47
-    public static function compile(Compiler $compiler, array $rest, array $tokens)
48
-    {
49
-        // load if plugin
50
-        if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
51
-            try {
52
-                $compiler->getDwoo()->getLoader()->loadPlugin('if');
53
-            }
54
-            catch (Exception $e) {
55
-                throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif');
56
-            }
57
-        }
39
+	/**
40
+	 * @param Compiler $compiler
41
+	 * @param array    $rest
42
+	 * @param array    $tokens
43
+	 *
44
+	 * @return mixed|string
45
+	 * @throws CompilationException
46
+	 */
47
+	public static function compile(Compiler $compiler, array $rest, array $tokens)
48
+	{
49
+		// load if plugin
50
+		if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
51
+			try {
52
+				$compiler->getDwoo()->getLoader()->loadPlugin('if');
53
+			}
54
+			catch (Exception $e) {
55
+				throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif');
56
+			}
57
+		}
58 58
 
59
-        if (count($rest) == 1) {
60
-            return $rest[0];
61
-        }
59
+		if (count($rest) == 1) {
60
+			return $rest[0];
61
+		}
62 62
 
63
-        // fetch false result and remove the ":" if it was present
64
-        $falseResult = array_pop($rest);
63
+		// fetch false result and remove the ":" if it was present
64
+		$falseResult = array_pop($rest);
65 65
 
66
-        if (trim(end($rest), '"\'') === ':') {
67
-            // remove the ':' if present
68
-            array_pop($rest);
69
-        } elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
70
-            if ($falseResult === '?' || $falseResult === ':') {
71
-                throw new CompilationException($compiler,
72
-                    'Tif: incomplete tif statement, value missing after ' . $falseResult);
73
-            }
74
-            // there was in fact no false result provided, so we move it to be the true result instead
75
-            $trueResult = $falseResult;
76
-            $falseResult = "''";
77
-        }
66
+		if (trim(end($rest), '"\'') === ':') {
67
+			// remove the ':' if present
68
+			array_pop($rest);
69
+		} elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
70
+			if ($falseResult === '?' || $falseResult === ':') {
71
+				throw new CompilationException($compiler,
72
+					'Tif: incomplete tif statement, value missing after ' . $falseResult);
73
+			}
74
+			// there was in fact no false result provided, so we move it to be the true result instead
75
+			$trueResult = $falseResult;
76
+			$falseResult = "''";
77
+		}
78 78
 
79
-        // fetch true result if needed
80
-        if (!isset($trueResult)) {
81
-            $trueResult = array_pop($rest);
82
-            // no true result provided so we use the expression arg
83
-            if ($trueResult === '?') {
84
-                $trueResult = true;
85
-            }
86
-        }
79
+		// fetch true result if needed
80
+		if (!isset($trueResult)) {
81
+			$trueResult = array_pop($rest);
82
+			// no true result provided so we use the expression arg
83
+			if ($trueResult === '?') {
84
+				$trueResult = true;
85
+			}
86
+		}
87 87
 
88
-        // remove the '?' if present
89
-        if (trim(end($rest), '"\'') === '?') {
90
-            array_pop($rest);
91
-        }
88
+		// remove the '?' if present
89
+		if (trim(end($rest), '"\'') === '?') {
90
+			array_pop($rest);
91
+		}
92 92
 
93
-        // check params were correctly provided
94
-        if (empty($rest) || $trueResult === null || $falseResult === null) {
95
-            throw new CompilationException($compiler,
96
-                'Tif: you must provide three parameters serving as <expression> ? <true value> : <false value>');
97
-        }
93
+		// check params were correctly provided
94
+		if (empty($rest) || $trueResult === null || $falseResult === null) {
95
+			throw new CompilationException($compiler,
96
+				'Tif: you must provide three parameters serving as <expression> ? <true value> : <false value>');
97
+		}
98 98
 
99
-        // parse condition
100
-        $condition = PluginIf::replaceKeywords($rest, $tokens, $compiler);
99
+		// parse condition
100
+		$condition = PluginIf::replaceKeywords($rest, $tokens, $compiler);
101 101
 
102
-        return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ',
103
-                $condition) : $trueResult) . ' : ' . $falseResult . ')';
104
-    }
102
+		return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ',
103
+				$condition) : $trueResult) . ' : ' . $falseResult . ')';
104
+	}
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public static function compile(Compiler $compiler, array $rest, array $tokens)
48 48
     {
49 49
         // load if plugin
50
-        if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
50
+        if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf')) {
51 51
             try {
52 52
                 $compiler->getDwoo()->getLoader()->loadPlugin('if');
53 53
             }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         } elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
70 70
             if ($falseResult === '?' || $falseResult === ':') {
71 71
                 throw new CompilationException($compiler,
72
-                    'Tif: incomplete tif statement, value missing after ' . $falseResult);
72
+                    'Tif: incomplete tif statement, value missing after '.$falseResult);
73 73
             }
74 74
             // there was in fact no false result provided, so we move it to be the true result instead
75 75
             $trueResult = $falseResult;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         // parse condition
100 100
         $condition = PluginIf::replaceKeywords($rest, $tokens, $compiler);
101 101
 
102
-        return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ',
103
-                $condition) : $trueResult) . ' : ' . $falseResult . ')';
102
+        return '(('.implode(' ', $condition).') ? '.($trueResult === true ? implode(' ',
103
+                $condition) : $trueResult).' : '.$falseResult.')';
104 104
     }
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
         if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) {
51 51
             try {
52 52
                 $compiler->getDwoo()->getLoader()->loadPlugin('if');
53
-            }
54
-            catch (Exception $e) {
53
+            } catch (Exception $e) {
55 54
                 throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif');
56 55
             }
57 56
         }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginStripTags.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@
 block discarded – undo
32 32
  */
33 33
 class PluginStripTags extends Plugin implements ICompilable
34 34
 {
35
-    /**
36
-     * @param Compiler    $compiler
37
-     * @param string      $value
38
-     * @param bool        $addspace
39
-     * @param null|string $allowable_tags
40
-     *
41
-     * @return string
42
-     */
43
-    public static function compile(Compiler $compiler, $value, $addspace = true, $allowable_tags = null)
44
-    {
45
-        if ($addspace === 'true') {
46
-            if ("null" == $allowable_tags) {
47
-                return "preg_replace('#<[^>]*>#', ' ', $value)";
48
-            }
35
+	/**
36
+	 * @param Compiler    $compiler
37
+	 * @param string      $value
38
+	 * @param bool        $addspace
39
+	 * @param null|string $allowable_tags
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public static function compile(Compiler $compiler, $value, $addspace = true, $allowable_tags = null)
44
+	{
45
+		if ($addspace === 'true') {
46
+			if ("null" == $allowable_tags) {
47
+				return "preg_replace('#<[^>]*>#', ' ', $value)";
48
+			}
49 49
 
50
-            return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
51
-        }
50
+			return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
51
+		}
52 52
 
53
-        return "strip_tags($value, $allowable_tags)";
54
-    }
53
+		return "strip_tags($value, $allowable_tags)";
54
+	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
                 return "preg_replace('#<[^>]*>#', ' ', $value)";
48 48
             }
49 49
 
50
-            return "preg_replace('#<\\s*\\/?(" . $allowable_tags . ")\\s*[^>]*?>#im', ' ', $value)";
50
+            return "preg_replace('#<\\s*\\/?(".$allowable_tags.")\\s*[^>]*?>#im', ' ', $value)";
51 51
         }
52 52
 
53 53
         return "strip_tags($value, $allowable_tags)";
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCapitalize.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -29,28 +29,28 @@
 block discarded – undo
29 29
  */
30 30
 class PluginCapitalize extends Plugin
31 31
 {
32
-    /**
33
-     * @param string $value
34
-     * @param bool   $numwords
35
-     *
36
-     * @return string
37
-     */
38
-    public function process($value, $numwords = false)
39
-    {
40
-        if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
-            return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
42
-        } else {
43
-            $bits = explode(' ', (string)$value);
44
-            $out  = '';
45
-            while (list(, $v) = each($bits)) {
46
-                if (preg_match('#^[^0-9]+$#', $v)) {
47
-                    $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48
-                } else {
49
-                    $out .= ' ' . $v;
50
-                }
51
-            }
32
+	/**
33
+	 * @param string $value
34
+	 * @param bool   $numwords
35
+	 *
36
+	 * @return string
37
+	 */
38
+	public function process($value, $numwords = false)
39
+	{
40
+		if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
+			return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
42
+		} else {
43
+			$bits = explode(' ', (string)$value);
44
+			$out  = '';
45
+			while (list(, $v) = each($bits)) {
46
+				if (preg_match('#^[^0-9]+$#', $v)) {
47
+					$out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48
+				} else {
49
+					$out .= ' ' . $v;
50
+				}
51
+			}
52 52
 
53
-            return substr($out, 1);
54
-        }
55
-    }
53
+			return substr($out, 1);
54
+		}
55
+	}
56 56
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
     public function process($value, $numwords = false)
39 39
     {
40 40
         if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
41
-            return mb_convert_case((string)$value, MB_CASE_TITLE, $this->core->getCharset());
41
+            return mb_convert_case((string) $value, MB_CASE_TITLE, $this->core->getCharset());
42 42
         } else {
43
-            $bits = explode(' ', (string)$value);
43
+            $bits = explode(' ', (string) $value);
44 44
             $out  = '';
45 45
             while (list(, $v) = each($bits)) {
46 46
                 if (preg_match('#^[^0-9]+$#', $v)) {
47
-                    $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
47
+                    $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $this->core->getCharset());
48 48
                 } else {
49
-                    $out .= ' ' . $v;
49
+                    $out .= ' '.$v;
50 50
                 }
51 51
             }
52 52
 
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginLoadTemplates.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -31,58 +31,58 @@  discard block
 block discarded – undo
31 31
  */
32 32
 class PluginLoadTemplates extends Plugin implements ICompilable
33 33
 {
34
-    /**
35
-     * @param Compiler $compiler
36
-     * @param string   $file
37
-     *
38
-     * @return string
39
-     * @throws CompilationException
40
-     */
41
-    public static function compile(Compiler $compiler, $file)
42
-    {
43
-        $file = substr($file, 1, - 1);
34
+	/**
35
+	 * @param Compiler $compiler
36
+	 * @param string   $file
37
+	 *
38
+	 * @return string
39
+	 * @throws CompilationException
40
+	 */
41
+	public static function compile(Compiler $compiler, $file)
42
+	{
43
+		$file = substr($file, 1, - 1);
44 44
 
45
-        if ($file === '') {
46
-            return '';
47
-        }
45
+		if ($file === '') {
46
+			return '';
47
+		}
48 48
 
49
-        if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
50
-            // resource:identifier given, extract them
51
-            $resource   = $m[1];
52
-            $identifier = $m[2];
53
-        } else {
54
-            // get the current template's resource
55
-            $resource   = $compiler->getDwoo()->getTemplate()->getResourceName();
56
-            $identifier = $file;
57
-        }
49
+		if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
50
+			// resource:identifier given, extract them
51
+			$resource   = $m[1];
52
+			$identifier = $m[2];
53
+		} else {
54
+			// get the current template's resource
55
+			$resource   = $compiler->getDwoo()->getTemplate()->getResourceName();
56
+			$identifier = $file;
57
+		}
58 58
 
59
-        $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier);
59
+		$tpl = $compiler->getDwoo()->templateFactory($resource, $identifier);
60 60
 
61
-        if ($tpl === null) {
62
-            throw new CompilationException($compiler,
63
-                'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.');
64
-        } elseif ($tpl === false) {
65
-            throw new CompilationException($compiler,
66
-                'Load Templates : Resource "' . $resource . '" does not support includes.');
67
-        }
61
+		if ($tpl === null) {
62
+			throw new CompilationException($compiler,
63
+				'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.');
64
+		} elseif ($tpl === false) {
65
+			throw new CompilationException($compiler,
66
+				'Load Templates : Resource "' . $resource . '" does not support includes.');
67
+		}
68 68
 
69
-        $cmp = clone $compiler;
70
-        $cmp->compile($compiler->getDwoo(), $tpl);
71
-        foreach ($cmp->getTemplatePlugins() as $template => $args) {
72
-            $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']);
73
-        }
74
-        foreach ($cmp->getUsedPlugins() as $plugin => $type) {
75
-            $compiler->addUsedPlugin($plugin, $type);
76
-        }
69
+		$cmp = clone $compiler;
70
+		$cmp->compile($compiler->getDwoo(), $tpl);
71
+		foreach ($cmp->getTemplatePlugins() as $template => $args) {
72
+			$compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']);
73
+		}
74
+		foreach ($cmp->getUsedPlugins() as $plugin => $type) {
75
+			$compiler->addUsedPlugin($plugin, $type);
76
+		}
77 77
 
78
-        $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n";
78
+		$out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n";
79 79
 
80
-        $modCheck = $tpl->getIsModifiedCode();
80
+		$modCheck = $tpl->getIsModifiedCode();
81 81
 
82
-        if ($modCheck) {
83
-            $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }';
84
-        } else {
85
-            $out .= 'try {
82
+		if ($modCheck) {
83
+			$out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }';
84
+		} else {
85
+			$out .= 'try {
86 86
 	$tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '");
87 87
 } catch (Dwoo\Exception $e) {
88 88
 	$this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING);
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 elseif ($tpl === false)
93 93
 	$this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING);
94 94
 if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }';
95
-        }
95
+		}
96 96
 
97
-        return $out;
98
-    }
97
+		return $out;
98
+	}
99 99
 }
100 100
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 
61 61
         if ($tpl === null) {
62 62
             throw new CompilationException($compiler,
63
-                'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.');
63
+                'Load Templates : Resource "'.$resource.':'.$identifier.'" not found.');
64 64
         } elseif ($tpl === false) {
65 65
             throw new CompilationException($compiler,
66
-                'Load Templates : Resource "' . $resource . '" does not support includes.');
66
+                'Load Templates : Resource "'.$resource.'" does not support includes.');
67 67
         }
68 68
 
69 69
         $cmp = clone $compiler;
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
             $compiler->addUsedPlugin($plugin, $type);
76 76
         }
77 77
 
78
-        $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n";
78
+        $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n";
79 79
 
80 80
         $modCheck = $tpl->getIsModifiedCode();
81 81
 
82 82
         if ($modCheck) {
83
-            $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }';
83
+            $out .= 'if (!('.$modCheck.')) { ob_end_clean(); return false; }';
84 84
         } else {
85 85
             $out .= 'try {
86
-	$tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '");
86
+	$tpl = $this->templateFactory("' . $resource.'", "'.$identifier.'");
87 87
 } catch (Dwoo\Exception $e) {
88
-	$this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING);
88
+	$this->triggerError(\'Load Templates : Resource <em>' . $resource.'</em> was not added to Dwoo, can not extend <em>'.$identifier.'</em>\', E_USER_WARNING);
89 89
 }
90 90
 if ($tpl === null)
91
-	$this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING);
91
+	$this->triggerError(\'Load Templates : Resource "' . $resource.':'.$identifier.'" was not found.\', E_USER_WARNING);
92 92
 elseif ($tpl === false)
93
-	$this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING);
94
-if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }';
93
+	$this->triggerError(\'Load Templates : Resource "' . $resource.'" does not support extends.\', E_USER_WARNING);
94
+if ($tpl->getUid() != "' . $tpl->getUid().'") { ob_end_clean(); return false; }';
95 95
         }
96 96
 
97 97
         return $out;
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCountSentences.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@
 block discarded – undo
30 30
  */
31 31
 class PluginCountSentences extends Plugin implements ICompilable
32 32
 {
33
-    /**
34
-     * @param Compiler $compiler
35
-     * @param string   $value
36
-     *
37
-     * @return string
38
-     */
39
-    public static function compile(Compiler $compiler, $value)
40
-    {
41
-        return "preg_match_all('#[\\w\\pL]\\.(?![\\w\\pL])#u', $value, \$tmp)";
42
-    }
33
+	/**
34
+	 * @param Compiler $compiler
35
+	 * @param string   $value
36
+	 *
37
+	 * @return string
38
+	 */
39
+	public static function compile(Compiler $compiler, $value)
40
+	{
41
+		return "preg_match_all('#[\\w\\pL]\\.(?![\\w\\pL])#u', $value, \$tmp)";
42
+	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginIndent.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@
 block discarded – undo
32 32
  */
33 33
 class PluginIndent extends Plugin implements ICompilable
34 34
 {
35
-    /**
36
-     * @param Compiler $compiler
37
-     * @param string   $value
38
-     * @param int      $by
39
-     * @param string   $char
40
-     *
41
-     * @return string
42
-     */
43
-    public static function compile(Compiler $compiler, $value, $by = 4, $char = ' ')
44
-    {
45
-        return "preg_replace('#^#m', '" . str_repeat(substr($char, 1, - 1), trim($by, '"\'')) . "', $value)";
46
-    }
35
+	/**
36
+	 * @param Compiler $compiler
37
+	 * @param string   $value
38
+	 * @param int      $by
39
+	 * @param string   $char
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public static function compile(Compiler $compiler, $value, $by = 4, $char = ' ')
44
+	{
45
+		return "preg_replace('#^#m', '" . str_repeat(substr($char, 1, - 1), trim($by, '"\'')) . "', $value)";
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
      */
43 43
     public static function compile(Compiler $compiler, $value, $by = 4, $char = ' ')
44 44
     {
45
-        return "preg_replace('#^#m', '" . str_repeat(substr($char, 1, - 1), trim($by, '"\'')) . "', $value)";
45
+        return "preg_replace('#^#m', '".str_repeat(substr($char, 1, - 1), trim($by, '"\''))."', $value)";
46 46
     }
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginTruncate.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,37 +33,37 @@
 block discarded – undo
33 33
  */
34 34
 class PluginTruncate extends Plugin
35 35
 {
36
-    /**
37
-     * @param string $value
38
-     * @param int    $length
39
-     * @param string $etc
40
-     * @param bool   $break
41
-     * @param bool   $middle
42
-     *
43
-     * @return mixed|string
44
-     */
45
-    public function process($value, $length = 80, $etc = '...', $break = false, $middle = false)
46
-    {
47
-        if ($length == 0) {
48
-            return '';
49
-        }
36
+	/**
37
+	 * @param string $value
38
+	 * @param int    $length
39
+	 * @param string $etc
40
+	 * @param bool   $break
41
+	 * @param bool   $middle
42
+	 *
43
+	 * @return mixed|string
44
+	 */
45
+	public function process($value, $length = 80, $etc = '...', $break = false, $middle = false)
46
+	{
47
+		if ($length == 0) {
48
+			return '';
49
+		}
50 50
 
51
-        $value  = (string)$value;
52
-        $etc    = (string)$etc;
53
-        $length = (int)$length;
51
+		$value  = (string)$value;
52
+		$etc    = (string)$etc;
53
+		$length = (int)$length;
54 54
 
55
-        if (strlen($value) < $length) {
56
-            return $value;
57
-        }
55
+		if (strlen($value) < $length) {
56
+			return $value;
57
+		}
58 58
 
59
-        $length = max($length - strlen($etc), 0);
60
-        if ($break === false && $middle === false) {
61
-            $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1));
62
-        }
63
-        if ($middle === false) {
64
-            return substr($value, 0, $length) . $etc;
65
-        }
59
+		$length = max($length - strlen($etc), 0);
60
+		if ($break === false && $middle === false) {
61
+			$value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1));
62
+		}
63
+		if ($middle === false) {
64
+			return substr($value, 0, $length) . $etc;
65
+		}
66 66
 
67
-        return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2));
68
-    }
67
+		return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2));
68
+	}
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,22 +48,22 @@
 block discarded – undo
48 48
             return '';
49 49
         }
50 50
 
51
-        $value  = (string)$value;
52
-        $etc    = (string)$etc;
53
-        $length = (int)$length;
51
+        $value  = (string) $value;
52
+        $etc    = (string) $etc;
53
+        $length = (int) $length;
54 54
 
55 55
         if (strlen($value) < $length) {
56 56
             return $value;
57 57
         }
58 58
 
59
-        $length = max($length - strlen($etc), 0);
59
+        $length = max($length-strlen($etc), 0);
60 60
         if ($break === false && $middle === false) {
61
-            $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1));
61
+            $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length+1));
62 62
         }
63 63
         if ($middle === false) {
64
-            return substr($value, 0, $length) . $etc;
64
+            return substr($value, 0, $length).$etc;
65 65
         }
66 66
 
67
-        return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2));
67
+        return substr($value, 0, ceil($length/2)).$etc.substr($value, - floor($length/2));
68 68
     }
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginDefault.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
  */
32 32
 class PluginDefault extends Plugin implements ICompilable
33 33
 {
34
-    /**
35
-     * @param Compiler $compiler
36
-     * @param mixed    $value
37
-     * @param string   $default
38
-     *
39
-     * @return string
40
-     */
41
-    public static function compile(Compiler $compiler, $value, $default = '')
42
-    {
43
-        return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)';
44
-    }
34
+	/**
35
+	 * @param Compiler $compiler
36
+	 * @param mixed    $value
37
+	 * @param string   $default
38
+	 *
39
+	 * @return string
40
+	 */
41
+	public static function compile(Compiler $compiler, $value, $default = '')
42
+	{
43
+		return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)';
44
+	}
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
      */
41 41
     public static function compile(Compiler $compiler, $value, $default = '')
42 42
     {
43
-        return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)';
43
+        return '(($tmp = '.$value.')===null||$tmp===\'\' ? '.$default.' : $tmp)';
44 44
     }
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.