File Source for RowIterator.php

PHPExcel_Worksheet

# Source for file RowIterator.php

Documentation is available at RowIterator.php

1. <?php
2. /**
3. * PHPExcel
4. *
5. * Copyright (c) 2006 - 2011 PHPExcel
6. *
7. * This library is free software; you can redistribute it and/or
8. * modify it under the terms of the GNU Lesser General Public
9. * License as published by the Free Software Foundation; either
10. * version 2.1 of the License, or (at your option) any later version.
11. *
12. * This library is distributed in the hope that it will be useful,
13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15. * Lesser General Public License for more details.
16. *
17. * You should have received a copy of the GNU Lesser General Public
18. * License along with this library; if not, write to the Free Software
19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20. *
21. * @category PHPExcel
22. * @package PHPExcel_Worksheet
23. * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25. * @version 1.7.6, 2011-02-27
26. */
29. /**
30. * PHPExcel_Worksheet_RowIterator
31. *
32. * Used to iterate rows in a PHPExcel_Worksheet
33. *
34. * @category PHPExcel
35. * @package PHPExcel_Worksheet
36. * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
37. */
38. class PHPExcel_Worksheet_RowIterator extends CachingIterator
39. {
40. /**
41. * PHPExcel_Worksheet to iterate
42. *
43. * @var PHPExcel_Worksheet
44. */
45. private $_subject;
47. /**
48. * Current iterator position
49. *
50. * @var int
51. */
52. private $_position = 1;
54. /**
55. * Create a new row iterator
56. *
57. * @param PHPExcel_Worksheet $subject
58. */
59. public function __construct(PHPExcel_Worksheet $subject = null) {
60. // Set subject
61. $this->_subject = $subject;
62. }
64. /**
65. * Destructor
66. */
67. public function __destruct() {
68. unset($this->_subject);
69. }
71. /**
72. * Rewind iterator
73. */
74. public function rewind() {
75. $this->_position = 1;
76. }
78. /**
79. * Current PHPExcel_Worksheet_Row
80. *
81. * @return PHPExcel_Worksheet_Row
82. */
83. public function current() {
84. return new PHPExcel_Worksheet_Row($this->_subject, $this->_position);
85. }
87. /**
88. * Current key
89. *
90. * @return int
91. */
92. public function key() {
93. return $this->_position;
94. }
96. /**
97. * Next value
98. */
99. public function next() {
100. ++$this->_position;
101. }
103. /**
104. * More PHPExcel_Worksheet_Row instances available?
105. *
106. * @return boolean
107. */
108. public function valid() {
109. return $this->_position <= $this->_subject-> getHighestRow();
110. }
111. }

Documentation generated on Sun, 27 Feb 2011 16:33:48 -0800 by phpDocumentor 1.4.3