88 *
99 * New BSD License
1010 *
11- * Copyright © 2007-2015, Ivan Enderlin . All rights reserved.
11+ * Copyright © 2007-2015, Hoa community . All rights reserved.
1212 *
1313 * Redistribution and use in source and binary forms, with or without
1414 * modification, are permitted provided that the following conditions are met:
4141 *
4242 * A counter.
4343 *
44- * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
45- * @copyright Copyright © 2007-2015 Ivan Enderlin.
44+ * @copyright Copyright © 2007-2015 Hoa community
4645 * @license New BSD License
4746 */
48-
49- class Counter implements Iterator {
50-
47+ class Counter implements Iterator
48+ {
5149 /**
5250 * From (lower bound).
5351 *
54- * @var \Hoa\Iterator\Counter int
52+ * @var int
5553 */
5654 protected $ _from = 0 ;
5755
5856 /**
5957 * Current key.
6058 *
61- * @var \Hoa\Iterator\Counter int
59+ * @var int
6260 */
6361 protected $ _key = 0 ;
6462
6563 /**
6664 * Current index.
6765 *
68- * @var \Hoa\Iterator\Counter int
66+ * @var int
6967 */
7068 protected $ _i = 0 ;
7169
7270 /**
7371 * To (upper bound).
7472 *
75- * @var \Hoa\Iterator\Counter int
73+ * @var int
7674 */
7775 protected $ _to = 0 ;
7876
7977 /**
8078 * Step.
8179 *
82- * @var \Hoa\Iterator\Counter int
80+ * @var int
8381 */
8482 protected $ _step = 0 ;
8583
@@ -90,18 +88,21 @@ class Counter implements Iterator {
9088 * Equivalent to:
9189 * for($i = $from; $i < $to; $i += $step)
9290 *
93- * @access public
9491 * @param int $from Start value.
9592 * @param int $to Maximum value.
9693 * @param int $step Step.
9794 * @return void
98- * @throw \Hoa\Iterator\Exception
95+ * @throws \Hoa\Iterator\Exception
9996 */
100- public function __construct ( $ from , $ to , $ step ) {
101-
102- if ($ step <= 0 )
97+ public function __construct ( $ from , $ to , $ step)
98+ {
99+ if ($ step <= 0 ) {
103100 throw new Exception (
104- 'The step must be non-negative; given %d. ' , 0 , $ step );
101+ 'The step must be non-negative; given %d. ' ,
102+ 0 ,
103+ $ step
104+ );
105+ }
105106
106107 $ this ->_from = $ from ;
107108 $ this ->_to = $ to ;
@@ -113,33 +114,30 @@ public function __construct ( $from, $to, $step ) {
113114 /**
114115 * Return the current element.
115116 *
116- * @access public
117117 * @return int
118118 */
119- public function current ( ) {
120-
119+ public function current ()
120+ {
121121 return $ this ->_i ;
122122 }
123123
124124 /**
125125 * Return the key of the current element.
126126 *
127- * @access public
128127 * @return int
129128 */
130- public function key ( ) {
131-
129+ public function key ()
130+ {
132131 return $ this ->_key ;
133132 }
134133
135134 /**
136135 * Move forward to next element.
137136 *
138- * @access public
139137 * @return void
140138 */
141- public function next ( ) {
142-
139+ public function next ()
140+ {
143141 ++$ this ->_key ;
144142 $ this ->_i += $ this ->_step ;
145143
@@ -149,11 +147,10 @@ public function next ( ) {
149147 /**
150148 * Rewind the iterator to the first element.
151149 *
152- * @access public
153150 * @return void
154151 */
155- public function rewind ( ) {
156-
152+ public function rewind ()
153+ {
157154 $ this ->_key = 0 ;
158155 $ this ->_i = $ this ->_from ;
159156
@@ -163,11 +160,10 @@ public function rewind ( ) {
163160 /**
164161 * Check if current position is valid.
165162 *
166- * @access public
167163 * @return bool
168164 */
169- public function valid ( ) {
170-
165+ public function valid ()
166+ {
171167 return $ this ->_i < $ this ->_to ;
172168 }
173169}
0 commit comments