Completed
Push — master ( a400a4...020752 )
by David
07:41 queued 04:43
created
lib/Dwoo/ILoader.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
  */
24 24
 interface ILoader
25 25
 {
26
-    /**
27
-     * Loads a plugin file.
28
-     * the second parameter is used to avoid permanent rehashing when using php functions,
29
-     * however this means that if you have add a plugin that overrides a php function you have
30
-     * to delete the classpath.cache file(s) by hand to force a rehash of the plugins
31
-     *
32
-     * @param string $class       the plugin name, without the `Plugin` prefix
33
-     * @param bool   $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it
34
-     *                            has just been added, defaults to true
35
-     */
36
-    public function loadPlugin($class, $forceRehash = true);
26
+	/**
27
+	 * Loads a plugin file.
28
+	 * the second parameter is used to avoid permanent rehashing when using php functions,
29
+	 * however this means that if you have add a plugin that overrides a php function you have
30
+	 * to delete the classpath.cache file(s) by hand to force a rehash of the plugins
31
+	 *
32
+	 * @param string $class       the plugin name, without the `Plugin` prefix
33
+	 * @param bool   $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it
34
+	 *                            has just been added, defaults to true
35
+	 */
36
+	public function loadPlugin($class, $forceRehash = true);
37 37
 }
Please login to merge, or discard this patch.
lib/Dwoo/ICompilable.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,6 +26,6 @@
 block discarded – undo
26 26
  */
27 27
 interface ICompilable
28 28
 {
29
-    // this replaces the process function
30
-    //public static function compile(Compiler $compiler, $arg, $arg, ...);
29
+	// this replaces the process function
30
+	//public static function compile(Compiler $compiler, $arg, $arg, ...);
31 31
 }
Please login to merge, or discard this patch.
lib/Dwoo/Processor.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,30 +23,30 @@
 block discarded – undo
23 23
  */
24 24
 abstract class Processor
25 25
 {
26
-    /**
27
-     * The compiler instance that runs this processor.
28
-     *
29
-     * @var Core
30
-     */
31
-    protected $compiler;
26
+	/**
27
+	 * The compiler instance that runs this processor.
28
+	 *
29
+	 * @var Core
30
+	 */
31
+	protected $compiler;
32 32
 
33
-    /**
34
-     * Constructor, if you override it, call parent::__construct($compiler); or assign
35
-     * the dwoo instance yourself if you need it.
36
-     *
37
-     * @param Compiler $compiler the compiler class
38
-     */
39
-    public function __construct(Compiler $compiler)
40
-    {
41
-        $this->compiler = $compiler;
42
-    }
33
+	/**
34
+	 * Constructor, if you override it, call parent::__construct($compiler); or assign
35
+	 * the dwoo instance yourself if you need it.
36
+	 *
37
+	 * @param Compiler $compiler the compiler class
38
+	 */
39
+	public function __construct(Compiler $compiler)
40
+	{
41
+		$this->compiler = $compiler;
42
+	}
43 43
 
44
-    /**
45
-     * Processes the input and returns it filtered.
46
-     *
47
-     * @param string $input the template to process
48
-     *
49
-     * @return string
50
-     */
51
-    abstract public function process($input);
44
+	/**
45
+	 * Processes the input and returns it filtered.
46
+	 *
47
+	 * @param string $input the template to process
48
+	 *
49
+	 * @return string
50
+	 */
51
+	abstract public function process($input);
52 52
 }
Please login to merge, or discard this patch.
lib/Dwoo/ICompiler.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,31 +29,31 @@
 block discarded – undo
29 29
  */
30 30
 interface ICompiler
31 31
 {
32
-    /**
33
-     * Compiles the provided string down to php code.
34
-     *
35
-     * @param Core      $dwoo
36
-     * @param ITemplate $template the template to compile
37
-     *
38
-     * @return string a compiled php code string
39
-     */
40
-    public function compile(Core $dwoo, ITemplate $template);
32
+	/**
33
+	 * Compiles the provided string down to php code.
34
+	 *
35
+	 * @param Core      $dwoo
36
+	 * @param ITemplate $template the template to compile
37
+	 *
38
+	 * @return string a compiled php code string
39
+	 */
40
+	public function compile(Core $dwoo, ITemplate $template);
41 41
 
42
-    /**
43
-     * Adds the custom plugins loaded into Dwoo to the compiler so it can load them.
44
-     *
45
-     * @see Core::addPlugin
46
-     *
47
-     * @param array $customPlugins an array of custom plugins
48
-     */
49
-    public function setCustomPlugins(array $customPlugins);
42
+	/**
43
+	 * Adds the custom plugins loaded into Dwoo to the compiler so it can load them.
44
+	 *
45
+	 * @see Core::addPlugin
46
+	 *
47
+	 * @param array $customPlugins an array of custom plugins
48
+	 */
49
+	public function setCustomPlugins(array $customPlugins);
50 50
 
51
-    /**
52
-     * Sets the security policy object to enforce some php security settings.
53
-     * use this if untrusted persons can modify templates,
54
-     * set it on the Dwoo object as it will be passed onto the compiler automatically
55
-     *
56
-     * @param SecurityPolicy $policy the security policy object
57
-     */
58
-    public function setSecurityPolicy(SecurityPolicy $policy = null);
51
+	/**
52
+	 * Sets the security policy object to enforce some php security settings.
53
+	 * use this if untrusted persons can modify templates,
54
+	 * set it on the Dwoo object as it will be passed onto the compiler automatically
55
+	 *
56
+	 * @param SecurityPolicy $policy the security policy object
57
+	 */
58
+	public function setSecurityPolicy(SecurityPolicy $policy = null);
59 59
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugin.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -25,81 +25,81 @@
 block discarded – undo
25 25
  */
26 26
 abstract class Plugin
27 27
 {
28
-    /**
29
-     * The dwoo instance that runs this plugin.
30
-     *
31
-     * @var Core
32
-     */
33
-    protected $core;
28
+	/**
29
+	 * The dwoo instance that runs this plugin.
30
+	 *
31
+	 * @var Core
32
+	 */
33
+	protected $core;
34 34
 
35
-    /**
36
-     * Constructor, if you override it, call parent::__construct($core); or assign
37
-     * the dwoo instance yourself if you need it.
38
-     *
39
-     * @param Core $core the dwoo instance that runs this plugin
40
-     */
41
-    public function __construct(Core $core)
42
-    {
43
-        $this->core = $core;
44
-    }
35
+	/**
36
+	 * Constructor, if you override it, call parent::__construct($core); or assign
37
+	 * the dwoo instance yourself if you need it.
38
+	 *
39
+	 * @param Core $core the dwoo instance that runs this plugin
40
+	 */
41
+	public function __construct(Core $core)
42
+	{
43
+		$this->core = $core;
44
+	}
45 45
 
46
-    // plugins should always implement :
47
-    // public function process($arg, $arg, ...)
48
-    // or for block plugins :
49
-    // public function init($arg, $arg, ...)
46
+	// plugins should always implement :
47
+	// public function process($arg, $arg, ...)
48
+	// or for block plugins :
49
+	// public function init($arg, $arg, ...)
50 50
 
51
-    // this could be enforced with :
52
-    // abstract public function process(...);
53
-    // if my feature request gets enough interest one day
54
-    // see => http://bugs.php.net/bug.php?id=44043
51
+	// this could be enforced with :
52
+	// abstract public function process(...);
53
+	// if my feature request gets enough interest one day
54
+	// see => http://bugs.php.net/bug.php?id=44043
55 55
 
56
-    /**
57
-     * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag
58
-     * attributes. this is to be used in preProcessing or postProcessing functions, example :
59
-     *  $p = $compiler->getCompiledParams($params);
60
-     *  // get only the rest array as attributes
61
-     *  $attributes = Plugin::paramsToAttributes($p['*']);
62
-     *  // get all the parameters as attributes (if there is a rest array, it will be included)
63
-     *  $attributes = Plugin::paramsToAttributes($p);
64
-     *
65
-     * @param array    $params   an array of attributeName=>value items that will be compiled to be ready for inclusion in a php string
66
-     *                                inclusion in a php string
67
-     * @param string   $delim    the string delimiter you want to use (defaults to ')
68
-     * @param Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper escaping behavior)
69
-     *                                escaping behavior)
70
-     *
71
-     * @return string
72
-     */
73
-    public static function paramsToAttributes(array $params, $delim = '\'', Compiler $compiler = null)
74
-    {
75
-        if (isset($params['*'])) {
76
-            $params = array_merge($params, $params['*']);
77
-            unset($params['*']);
78
-        }
56
+	/**
57
+	 * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag
58
+	 * attributes. this is to be used in preProcessing or postProcessing functions, example :
59
+	 *  $p = $compiler->getCompiledParams($params);
60
+	 *  // get only the rest array as attributes
61
+	 *  $attributes = Plugin::paramsToAttributes($p['*']);
62
+	 *  // get all the parameters as attributes (if there is a rest array, it will be included)
63
+	 *  $attributes = Plugin::paramsToAttributes($p);
64
+	 *
65
+	 * @param array    $params   an array of attributeName=>value items that will be compiled to be ready for inclusion in a php string
66
+	 *                                inclusion in a php string
67
+	 * @param string   $delim    the string delimiter you want to use (defaults to ')
68
+	 * @param Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper escaping behavior)
69
+	 *                                escaping behavior)
70
+	 *
71
+	 * @return string
72
+	 */
73
+	public static function paramsToAttributes(array $params, $delim = '\'', Compiler $compiler = null)
74
+	{
75
+		if (isset($params['*'])) {
76
+			$params = array_merge($params, $params['*']);
77
+			unset($params['*']);
78
+		}
79 79
 
80
-        $out = '';
81
-        foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
83
-            if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
85
-            } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
87
-            } else {
88
-                if (!$compiler) {
89
-                    // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91
-                } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92
-                    // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94
-                } else {
95
-                    // print as is
96
-                    $escapedVal = '.' . $val . '.';
97
-                }
80
+		$out = '';
81
+		foreach ($params as $attr => $val) {
82
+			$out .= ' ' . $attr . '=';
83
+			if (trim($val, '"\'') == '' || $val == 'null') {
84
+				$out .= str_replace($delim, '\\' . $delim, '""');
85
+			} elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
+				$out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
87
+			} else {
88
+				if (!$compiler) {
89
+					// disable double encoding since it can not be determined if it was encoded
90
+					$escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91
+				} elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92
+					// escape if auto escaping is disabled, or there was no variable in the string
93
+					$escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94
+				} else {
95
+					// print as is
96
+					$escapedVal = '.' . $val . '.';
97
+				}
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
100
-            }
101
-        }
99
+				$out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
100
+			}
101
+		}
102 102
 
103
-        return ltrim($out);
104
-    }
103
+		return ltrim($out);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,24 +79,24 @@
 block discarded – undo
79 79
 
80 80
         $out = '';
81 81
         foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
82
+            $out .= ' '.$attr.'=';
83 83
             if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
84
+                $out .= str_replace($delim, '\\'.$delim, '""');
85 85
             } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
86
+                $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"');
87 87
             } else {
88 88
                 if (!$compiler) {
89 89
                     // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
90
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91 91
                 } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92 92
                     // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
93
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94 94
                 } else {
95 95
                     // print as is
96
-                    $escapedVal = '.' . $val . '.';
96
+                    $escapedVal = '.'.$val.'.';
97 97
                 }
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
99
+                $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"');
100 100
             }
101 101
         }
102 102
 
Please login to merge, or discard this patch.
lib/Dwoo/IDataProvider.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
  */
24 24
 interface IDataProvider
25 25
 {
26
-    /**
27
-     * Returns the data as an associative array that will be used in the template.
28
-     *
29
-     * @return array
30
-     */
31
-    public function getData();
26
+	/**
27
+	 * Returns the data as an associative array that will be used in the template.
28
+	 *
29
+	 * @return array
30
+	 */
31
+	public function getData();
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Block/Plugin.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -28,92 +28,92 @@
 block discarded – undo
28 28
  */
29 29
 abstract class Plugin extends DwooPlugin
30 30
 {
31
-    /**
32
-     * Stores the contents of the block while it runs.
33
-     *
34
-     * @var string
35
-     */
36
-    protected $buffer = '';
31
+	/**
32
+	 * Stores the contents of the block while it runs.
33
+	 *
34
+	 * @var string
35
+	 */
36
+	protected $buffer = '';
37 37
 
38
-    /**
39
-     * Buffers input, override only if necessary.
40
-     *
41
-     * @var string the content that must be buffered
42
-     */
43
-    public function buffer($input)
44
-    {
45
-        $this->buffer .= $input;
46
-    }
38
+	/**
39
+	 * Buffers input, override only if necessary.
40
+	 *
41
+	 * @var string the content that must be buffered
42
+	 */
43
+	public function buffer($input)
44
+	{
45
+		$this->buffer .= $input;
46
+	}
47 47
 
48
-    // initialization code, receives the parameters from {block param1 param2}
49
-    // public function init($arg, $arg, ...);
48
+	// initialization code, receives the parameters from {block param1 param2}
49
+	// public function init($arg, $arg, ...);
50 50
 
51
-    /**
52
-     * Called when the block ends, this is most of the time followed right away by a call
53
-     * of <em>process()</em> but not always, so this should be used to do any shutdown operations on the
54
-     * block object, if required.
55
-     */
56
-    public function end()
57
-    {
58
-    }
51
+	/**
52
+	 * Called when the block ends, this is most of the time followed right away by a call
53
+	 * of <em>process()</em> but not always, so this should be used to do any shutdown operations on the
54
+	 * block object, if required.
55
+	 */
56
+	public function end()
57
+	{
58
+	}
59 59
 
60
-    /**
61
-     * Called when the block output is required by a parent block.
62
-     * this must read $this->buffer and return it processed
63
-     *
64
-     * @return string
65
-     */
66
-    public function process()
67
-    {
68
-        return $this->buffer;
69
-    }
60
+	/**
61
+	 * Called when the block output is required by a parent block.
62
+	 * this must read $this->buffer and return it processed
63
+	 *
64
+	 * @return string
65
+	 */
66
+	public function process()
67
+	{
68
+		return $this->buffer;
69
+	}
70 70
 
71
-    /**
72
-     * Called at compile time to define what the block should output in the compiled template code, happens when the
73
-     * block is declared basically this will replace the {block arg arg arg} tag in the template.
74
-     *
75
-     * @param DwooCompiler $compiler the compiler instance that calls this function
76
-     * @param array        $params   an array containing original and compiled parameters
77
-     * @param string       $prepend  that is just meant to allow a child class to call
78
-     *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
79
-     *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
80
-     *                               to add a command before the default commands are executed
81
-     * @param string       $append   that is just meant to allow a child class to call
82
-     *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
83
-     *                               the default commands are executed parent::postProcessing($compiler, $params, null,
84
-     *                               "foo();") to add a command after the default commands are executed
85
-     * @param string       $type     the type is the plugin class name used
86
-     *
87
-     * @return string
88
-     */
89
-    public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type)
90
-    {
91
-        return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE;
92
-    }
71
+	/**
72
+	 * Called at compile time to define what the block should output in the compiled template code, happens when the
73
+	 * block is declared basically this will replace the {block arg arg arg} tag in the template.
74
+	 *
75
+	 * @param DwooCompiler $compiler the compiler instance that calls this function
76
+	 * @param array        $params   an array containing original and compiled parameters
77
+	 * @param string       $prepend  that is just meant to allow a child class to call
78
+	 *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
79
+	 *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
80
+	 *                               to add a command before the default commands are executed
81
+	 * @param string       $append   that is just meant to allow a child class to call
82
+	 *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
83
+	 *                               the default commands are executed parent::postProcessing($compiler, $params, null,
84
+	 *                               "foo();") to add a command after the default commands are executed
85
+	 * @param string       $type     the type is the plugin class name used
86
+	 *
87
+	 * @return string
88
+	 */
89
+	public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type)
90
+	{
91
+		return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE;
92
+	}
93 93
 
94
-    /**
95
-     * Called at compile time to define what the block should output in the compiled template code, happens when the
96
-     * block is ended basically this will replace the {/block} tag in the template.
97
-     *
98
-     * @see preProcessing
99
-     *
100
-     * @param DwooCompiler $compiler the compiler instance that calls this function
101
-     * @param array        $params   an array containing original and compiled parameters, see preProcessing() for more
102
-     *                               details more details
103
-     * @param string       $prepend  that is just meant to allow a child class to call
104
-     *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
105
-     *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
106
-     *                               to add a command before the default commands are executed
107
-     * @param string       $append   that is just meant to allow a child class to call
108
-     *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
109
-     *                               the default commands are executed parent::postProcessing($compiler, $params, null,
110
-     *                               "foo();") to add a command after the default commands are executed
111
-     * @param string       $content  the entire content of the block being closed
112
-     *
113
-     * @return string
114
-     */
115
-    public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content)
116
-    {
117
-        return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE;
118
-    }
94
+	/**
95
+	 * Called at compile time to define what the block should output in the compiled template code, happens when the
96
+	 * block is ended basically this will replace the {/block} tag in the template.
97
+	 *
98
+	 * @see preProcessing
99
+	 *
100
+	 * @param DwooCompiler $compiler the compiler instance that calls this function
101
+	 * @param array        $params   an array containing original and compiled parameters, see preProcessing() for more
102
+	 *                               details more details
103
+	 * @param string       $prepend  that is just meant to allow a child class to call
104
+	 *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
105
+	 *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
106
+	 *                               to add a command before the default commands are executed
107
+	 * @param string       $append   that is just meant to allow a child class to call
108
+	 *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
109
+	 *                               the default commands are executed parent::postProcessing($compiler, $params, null,
110
+	 *                               "foo();") to add a command after the default commands are executed
111
+	 * @param string       $content  the entire content of the block being closed
112
+	 *
113
+	 * @return string
114
+	 */
115
+	public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content)
116
+	{
117
+		return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE;
118
+	}
119 119
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type)
90 90
     {
91
-        return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE;
91
+        return DwooCompiler::PHP_OPEN.$prepend.'$this->addStack("'.$type.'", array('.DwooCompiler::implode_r($compiler->getCompiledParams($params)).'));'.$append.DwooCompiler::PHP_CLOSE;
92 92
     }
93 93
 
94 94
     /**
@@ -114,6 +114,6 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content)
116 116
     {
117
-        return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE;
117
+        return $content.DwooCompiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.DwooCompiler::PHP_CLOSE;
118 118
     }
119 119
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginExtends.php 3 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -34,28 +34,28 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class PluginExtends extends Plugin implements ICompilable
36 36
 {
37
-    protected static $childSource;
38
-    protected static $regex;
39
-    protected static $l;
40
-    protected static $r;
41
-    protected static $lastReplacement;
42
-
43
-    public function process()
44
-    {
45
-    }
46
-
47
-    /**
48
-     * @param Compiler $compiler
49
-     * @param          $file
50
-     *
51
-     * @throws CompilationException
52
-     */
53
-    public static function compile(Compiler $compiler, $file)
54
-    {
55
-        list($l, $r) = $compiler->getDelimiters();
56
-        self::$l     = preg_quote($l, '/');
57
-        self::$r     = preg_quote($r, '/');
58
-        self::$regex = '/
37
+	protected static $childSource;
38
+	protected static $regex;
39
+	protected static $l;
40
+	protected static $r;
41
+	protected static $lastReplacement;
42
+
43
+	public function process()
44
+	{
45
+	}
46
+
47
+	/**
48
+	 * @param Compiler $compiler
49
+	 * @param          $file
50
+	 *
51
+	 * @throws CompilationException
52
+	 */
53
+	public static function compile(Compiler $compiler, $file)
54
+	{
55
+		list($l, $r) = $compiler->getDelimiters();
56
+		self::$l     = preg_quote($l, '/');
57
+		self::$r     = preg_quote($r, '/');
58
+		self::$regex = '/
59 59
 			' . self::$l . 'block\s(["\']?)(.+?)\1' . self::$r . '(?:\r?\n?)
60 60
 			((?:
61 61
 				(?R)
@@ -70,137 +70,137 @@  discard block
 block discarded – undo
70 70
 			' . self::$l . '\/block' . self::$r . '
71 71
 			/six';
72 72
 
73
-        if ($compiler->getLooseOpeningHandling()) {
74
-            self::$l .= '\s*';
75
-            self::$r = '\s*' . self::$r;
76
-        }
77
-        $inheritanceTree = array(array('source' => $compiler->getTemplateSource()));
78
-        $curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR;
79
-        $curTpl          = $compiler->getDwoo()->getTemplate();
80
-
81
-        while (!empty($file)) {
82
-            if ($file === '""' || $file === "''" || (substr($file, 0, 1) !== '"' && substr($file, 0, 1) !== '\'')) {
83
-                throw new CompilationException($compiler, 'Extends : The file name must be a non-empty string');
84
-            }
85
-
86
-            if (preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m)) {
87
-                // resource:identifier given, extract them
88
-                $resource   = $m[1];
89
-                $identifier = $m[2];
90
-            } else {
91
-                // get the current template's resource
92
-                $resource   = $curTpl->getResourceName();
93
-                $identifier = substr($file, 1, - 1);
94
-            }
95
-
96
-            try {
97
-                $parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98
-            }
99
-            catch (SecurityException $e) {
100
-                throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
101
-            }
102
-            catch (Exception $e) {
103
-                throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
104
-            }
105
-
106
-            if ($parent === null) {
107
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.');
108
-            } elseif ($parent === false) {
109
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.');
110
-            }
111
-
112
-            $curTpl    = $parent;
113
-            $newParent = array(
114
-                'source'     => $parent->getSource(),
115
-                'resource'   => $resource,
116
-                'identifier' => $parent->getResourceIdentifier(),
117
-                'uid'        => $parent->getUid()
118
-            );
119
-            if (array_search($newParent, $inheritanceTree, true) !== false) {
120
-                throw new CompilationException($compiler, 'Extends : Recursive template inheritance detected');
121
-            }
122
-            $inheritanceTree[] = $newParent;
123
-
124
-            if (preg_match('/^' . self::$l . 'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?' . self::$r . '/i', $parent->getSource(), $match)) {
125
-                $curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
126
-                if (isset($match[2]) && $match[2] == '"') {
127
-                    $file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"';
128
-                } elseif (isset($match[2]) && $match[2] == "'") {
129
-                    $file = '"' . substr($match[1], 1, - 1) . '"';
130
-                } else {
131
-                    $file = '"' . $match[1] . '"';
132
-                }
133
-            } else {
134
-                $file = false;
135
-            }
136
-        }
137
-
138
-        while (true) {
139
-            $parent                = array_pop($inheritanceTree);
140
-            $child                 = end($inheritanceTree);
141
-            self::$childSource     = $child['source'];
142
-            self::$lastReplacement = count($inheritanceTree) === 1;
143
-            if (!isset($newSource)) {
144
-                $newSource = $parent['source'];
145
-            }
146
-            $newSource = preg_replace_callback(self::$regex, array(
147
-                'Dwoo\Plugins\Functions\PluginExtends',
148
-                'replaceBlock'
149
-            ), $newSource);
150
-            $newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource;
151
-
152
-            if (self::$lastReplacement) {
153
-                break;
154
-            }
155
-        }
156
-        $compiler->setTemplateSource($newSource);
157
-        $compiler->recompile();
158
-    }
159
-
160
-    /**
161
-     * @param array $matches
162
-     *
163
-     * @return mixed|string
164
-     */
165
-    protected static function replaceBlock(array $matches)
166
-    {
167
-        $matches[3] = self::removeTrailingNewline($matches[3]);
168
-
169
-        if (preg_match_all(self::$regex, self::$childSource, $override) && in_array($matches[2], $override[2])) {
170
-            $key      = array_search($matches[2], $override[2]);
171
-            $override = self::removeTrailingNewline($override[3][$key]);
172
-
173
-            $l = stripslashes(self::$l);
174
-            $r = stripslashes(self::$r);
175
-
176
-            if (self::$lastReplacement) {
177
-                return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override);
178
-            }
179
-
180
-            return $l . 'block ' . $matches[1] . $matches[2] . $matches[1] . $r . preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override) . $l . '/block' . $r;
181
-        }
182
-
183
-        if (preg_match(self::$regex, $matches[3])) {
184
-            return preg_replace_callback(self::$regex, array(
185
-                'Dwoo\Plugins\Functions\PluginExtends',
186
-                'replaceBlock'
187
-            ), $matches[3]);
188
-        }
189
-
190
-        if (self::$lastReplacement) {
191
-            return $matches[3];
192
-        }
193
-
194
-        return $matches[0];
195
-    }
196
-
197
-    /**
198
-     * @param $text
199
-     *
200
-     * @return string
201
-     */
202
-    protected static function removeTrailingNewline($text)
203
-    {
204
-        return substr($text, - 1) === "\n" ? substr($text, - 2, 1) === "\r" ? substr($text, 0, - 2) : substr($text, 0, - 1) : $text;
205
-    }
73
+		if ($compiler->getLooseOpeningHandling()) {
74
+			self::$l .= '\s*';
75
+			self::$r = '\s*' . self::$r;
76
+		}
77
+		$inheritanceTree = array(array('source' => $compiler->getTemplateSource()));
78
+		$curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR;
79
+		$curTpl          = $compiler->getDwoo()->getTemplate();
80
+
81
+		while (!empty($file)) {
82
+			if ($file === '""' || $file === "''" || (substr($file, 0, 1) !== '"' && substr($file, 0, 1) !== '\'')) {
83
+				throw new CompilationException($compiler, 'Extends : The file name must be a non-empty string');
84
+			}
85
+
86
+			if (preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m)) {
87
+				// resource:identifier given, extract them
88
+				$resource   = $m[1];
89
+				$identifier = $m[2];
90
+			} else {
91
+				// get the current template's resource
92
+				$resource   = $curTpl->getResourceName();
93
+				$identifier = substr($file, 1, - 1);
94
+			}
95
+
96
+			try {
97
+				$parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98
+			}
99
+			catch (SecurityException $e) {
100
+				throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
101
+			}
102
+			catch (Exception $e) {
103
+				throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
104
+			}
105
+
106
+			if ($parent === null) {
107
+				throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.');
108
+			} elseif ($parent === false) {
109
+				throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.');
110
+			}
111
+
112
+			$curTpl    = $parent;
113
+			$newParent = array(
114
+				'source'     => $parent->getSource(),
115
+				'resource'   => $resource,
116
+				'identifier' => $parent->getResourceIdentifier(),
117
+				'uid'        => $parent->getUid()
118
+			);
119
+			if (array_search($newParent, $inheritanceTree, true) !== false) {
120
+				throw new CompilationException($compiler, 'Extends : Recursive template inheritance detected');
121
+			}
122
+			$inheritanceTree[] = $newParent;
123
+
124
+			if (preg_match('/^' . self::$l . 'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?' . self::$r . '/i', $parent->getSource(), $match)) {
125
+				$curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
126
+				if (isset($match[2]) && $match[2] == '"') {
127
+					$file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"';
128
+				} elseif (isset($match[2]) && $match[2] == "'") {
129
+					$file = '"' . substr($match[1], 1, - 1) . '"';
130
+				} else {
131
+					$file = '"' . $match[1] . '"';
132
+				}
133
+			} else {
134
+				$file = false;
135
+			}
136
+		}
137
+
138
+		while (true) {
139
+			$parent                = array_pop($inheritanceTree);
140
+			$child                 = end($inheritanceTree);
141
+			self::$childSource     = $child['source'];
142
+			self::$lastReplacement = count($inheritanceTree) === 1;
143
+			if (!isset($newSource)) {
144
+				$newSource = $parent['source'];
145
+			}
146
+			$newSource = preg_replace_callback(self::$regex, array(
147
+				'Dwoo\Plugins\Functions\PluginExtends',
148
+				'replaceBlock'
149
+			), $newSource);
150
+			$newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource;
151
+
152
+			if (self::$lastReplacement) {
153
+				break;
154
+			}
155
+		}
156
+		$compiler->setTemplateSource($newSource);
157
+		$compiler->recompile();
158
+	}
159
+
160
+	/**
161
+	 * @param array $matches
162
+	 *
163
+	 * @return mixed|string
164
+	 */
165
+	protected static function replaceBlock(array $matches)
166
+	{
167
+		$matches[3] = self::removeTrailingNewline($matches[3]);
168
+
169
+		if (preg_match_all(self::$regex, self::$childSource, $override) && in_array($matches[2], $override[2])) {
170
+			$key      = array_search($matches[2], $override[2]);
171
+			$override = self::removeTrailingNewline($override[3][$key]);
172
+
173
+			$l = stripslashes(self::$l);
174
+			$r = stripslashes(self::$r);
175
+
176
+			if (self::$lastReplacement) {
177
+				return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override);
178
+			}
179
+
180
+			return $l . 'block ' . $matches[1] . $matches[2] . $matches[1] . $r . preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override) . $l . '/block' . $r;
181
+		}
182
+
183
+		if (preg_match(self::$regex, $matches[3])) {
184
+			return preg_replace_callback(self::$regex, array(
185
+				'Dwoo\Plugins\Functions\PluginExtends',
186
+				'replaceBlock'
187
+			), $matches[3]);
188
+		}
189
+
190
+		if (self::$lastReplacement) {
191
+			return $matches[3];
192
+		}
193
+
194
+		return $matches[0];
195
+	}
196
+
197
+	/**
198
+	 * @param $text
199
+	 *
200
+	 * @return string
201
+	 */
202
+	protected static function removeTrailingNewline($text)
203
+	{
204
+		return substr($text, - 1) === "\n" ? substr($text, - 2, 1) === "\r" ? substr($text, 0, - 2) : substr($text, 0, - 1) : $text;
205
+	}
206 206
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
         self::$l     = preg_quote($l, '/');
57 57
         self::$r     = preg_quote($r, '/');
58 58
         self::$regex = '/
59
-			' . self::$l . 'block\s(["\']?)(.+?)\1' . self::$r . '(?:\r?\n?)
59
+			' . self::$l.'block\s(["\']?)(.+?)\1'.self::$r.'(?:\r?\n?)
60 60
 			((?:
61 61
 				(?R)
62 62
 				|
63
-				[^' . self::$l . ']*
63
+				[^' . self::$l.']*
64 64
 				(?:
65
-					(?! ' . self::$l . '\/?block\b )
66
-					' . self::$l . '
67
-					[^' . self::$l . ']*+
65
+					(?! ' . self::$l.'\/?block\b )
66
+					' . self::$l.'
67
+					[^' . self::$l.']*+
68 68
 				)*
69 69
 			)*)
70
-			' . self::$l . '\/block' . self::$r . '
70
+			' . self::$l.'\/block'.self::$r.'
71 71
 			/six';
72 72
 
73 73
         if ($compiler->getLooseOpeningHandling()) {
74 74
             self::$l .= '\s*';
75
-            self::$r = '\s*' . self::$r;
75
+            self::$r = '\s*'.self::$r;
76 76
         }
77 77
         $inheritanceTree = array(array('source' => $compiler->getTemplateSource()));
78
-        $curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR;
78
+        $curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()).DIRECTORY_SEPARATOR;
79 79
         $curTpl          = $compiler->getDwoo()->getTemplate();
80 80
 
81 81
         while (!empty($file)) {
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
                 $parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98 98
             }
99 99
             catch (SecurityException $e) {
100
-                throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
100
+                throw new CompilationException($compiler, 'Extends : Security restriction : '.$e->getMessage());
101 101
             }
102 102
             catch (Exception $e) {
103
-                throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
103
+                throw new CompilationException($compiler, 'Extends : '.$e->getMessage());
104 104
             }
105 105
 
106 106
             if ($parent === null) {
107
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.');
107
+                throw new CompilationException($compiler, 'Extends : Resource "'.$resource.':'.$identifier.'" not found.');
108 108
             } elseif ($parent === false) {
109
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.');
109
+                throw new CompilationException($compiler, 'Extends : Resource "'.$resource.'" does not support extends.');
110 110
             }
111 111
 
112 112
             $curTpl    = $parent;
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
             }
122 122
             $inheritanceTree[] = $newParent;
123 123
 
124
-            if (preg_match('/^' . self::$l . 'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?' . self::$r . '/i', $parent->getSource(), $match)) {
125
-                $curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
124
+            if (preg_match('/^'.self::$l.'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?'.self::$r.'/i', $parent->getSource(), $match)) {
125
+                $curPath = dirname($identifier).DIRECTORY_SEPARATOR;
126 126
                 if (isset($match[2]) && $match[2] == '"') {
127
-                    $file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"';
127
+                    $file = '"'.str_replace('"', '\\"', substr($match[1], 1, - 1)).'"';
128 128
                 } elseif (isset($match[2]) && $match[2] == "'") {
129
-                    $file = '"' . substr($match[1], 1, - 1) . '"';
129
+                    $file = '"'.substr($match[1], 1, - 1).'"';
130 130
                 } else {
131
-                    $file = '"' . $match[1] . '"';
131
+                    $file = '"'.$match[1].'"';
132 132
                 }
133 133
             } else {
134 134
                 $file = false;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                 'Dwoo\Plugins\Functions\PluginExtends',
148 148
                 'replaceBlock'
149 149
             ), $newSource);
150
-            $newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource;
150
+            $newSource = $l.'do extendsCheck('.var_export($parent['resource'].':'.$parent['identifier'], true).')'.$r.$newSource;
151 151
 
152 152
             if (self::$lastReplacement) {
153 153
                 break;
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
             $r = stripslashes(self::$r);
175 175
 
176 176
             if (self::$lastReplacement) {
177
-                return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override);
177
+                return preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override);
178 178
             }
179 179
 
180
-            return $l . 'block ' . $matches[1] . $matches[2] . $matches[1] . $r . preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override) . $l . '/block' . $r;
180
+            return $l.'block '.$matches[1].$matches[2].$matches[1].$r.preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override).$l.'/block'.$r;
181 181
         }
182 182
 
183 183
         if (preg_match(self::$regex, $matches[3])) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -95,11 +95,9 @@
 block discarded – undo
95 95
 
96 96
             try {
97 97
                 $parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98
-            }
99
-            catch (SecurityException $e) {
98
+            } catch (SecurityException $e) {
100 99
                 throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
101
-            }
102
-            catch (Exception $e) {
100
+            } catch (Exception $e) {
103 101
                 throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
104 102
             }
105 103
 
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCycle.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@
 block discarded – undo
74 74
         }
75 75
 
76 76
         if ($advance) {
77
-            if ($this->cycles[$name]['index'] >= count($values) - 1) {
77
+            if ($this->cycles[$name]['index'] >= count($values)-1) {
78 78
                 $this->cycles[$name]['index'] = 0;
79 79
             } else {
80
-                ++ $this->cycles[$name]['index'];
80
+                ++$this->cycles[$name]['index'];
81 81
             }
82 82
         }
83 83
 
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -34,58 +34,58 @@
 block discarded – undo
34 34
  */
35 35
 class PluginCycle extends Plugin
36 36
 {
37
-    protected $cycles = array();
37
+	protected $cycles = array();
38 38
 
39
-    /**
40
-     * @param string $name
41
-     * @param null   $values
42
-     * @param bool   $print
43
-     * @param bool   $advance
44
-     * @param string $delimiter
45
-     * @param null   $assign
46
-     * @param bool   $reset
47
-     *
48
-     * @return string|null
49
-     */
50
-    public function process($name = 'default', $values = null, $print = true, $advance = true, $delimiter = ',', $assign = null, $reset = false)
51
-    {
52
-        if ($values !== null) {
53
-            if (is_string($values)) {
54
-                $values = explode($delimiter, $values);
55
-            }
39
+	/**
40
+	 * @param string $name
41
+	 * @param null   $values
42
+	 * @param bool   $print
43
+	 * @param bool   $advance
44
+	 * @param string $delimiter
45
+	 * @param null   $assign
46
+	 * @param bool   $reset
47
+	 *
48
+	 * @return string|null
49
+	 */
50
+	public function process($name = 'default', $values = null, $print = true, $advance = true, $delimiter = ',', $assign = null, $reset = false)
51
+	{
52
+		if ($values !== null) {
53
+			if (is_string($values)) {
54
+				$values = explode($delimiter, $values);
55
+			}
56 56
 
57
-            if (!isset($this->cycles[$name]) || $this->cycles[$name]['values'] !== $values) {
58
-                $this->cycles[$name]['index'] = 0;
59
-            }
57
+			if (!isset($this->cycles[$name]) || $this->cycles[$name]['values'] !== $values) {
58
+				$this->cycles[$name]['index'] = 0;
59
+			}
60 60
 
61
-            $this->cycles[$name]['values'] = array_values($values);
62
-        } elseif (isset($this->cycles[$name])) {
63
-            $values = $this->cycles[$name]['values'];
64
-        }
61
+			$this->cycles[$name]['values'] = array_values($values);
62
+		} elseif (isset($this->cycles[$name])) {
63
+			$values = $this->cycles[$name]['values'];
64
+		}
65 65
 
66
-        if ($reset) {
67
-            $this->cycles[$name]['index'] = 0;
68
-        }
66
+		if ($reset) {
67
+			$this->cycles[$name]['index'] = 0;
68
+		}
69 69
 
70
-        if ($print) {
71
-            $out = $values[$this->cycles[$name]['index']];
72
-        } else {
73
-            $out = null;
74
-        }
70
+		if ($print) {
71
+			$out = $values[$this->cycles[$name]['index']];
72
+		} else {
73
+			$out = null;
74
+		}
75 75
 
76
-        if ($advance) {
77
-            if ($this->cycles[$name]['index'] >= count($values) - 1) {
78
-                $this->cycles[$name]['index'] = 0;
79
-            } else {
80
-                ++ $this->cycles[$name]['index'];
81
-            }
82
-        }
76
+		if ($advance) {
77
+			if ($this->cycles[$name]['index'] >= count($values) - 1) {
78
+				$this->cycles[$name]['index'] = 0;
79
+			} else {
80
+				++ $this->cycles[$name]['index'];
81
+			}
82
+		}
83 83
 
84
-        if ($assign === null) {
85
-            return $out;
86
-        }
87
-        $this->core->assignInScope($out, $assign);
84
+		if ($assign === null) {
85
+			return $out;
86
+		}
87
+		$this->core->assignInScope($out, $assign);
88 88
 
89
-        return null;
90
-    }
89
+		return null;
90
+	}
91 91
 }
Please login to merge, or discard this patch.