@@ -35,40 +35,40 @@ |
||
35 | 35 | */ |
36 | 36 | interface PHPExcel_CachedObjectStorage_ICache |
37 | 37 | { |
38 | - /** |
|
39 | - * Add or Update a cell in cache identified by coordinate address |
|
40 | - * |
|
41 | - * @param string $pCoord Coordinate address of the cell to update |
|
42 | - * @param PHPExcel_Cell $cell Cell to update |
|
38 | + /** |
|
39 | + * Add or Update a cell in cache identified by coordinate address |
|
40 | + * |
|
41 | + * @param string $pCoord Coordinate address of the cell to update |
|
42 | + * @param PHPExcel_Cell $cell Cell to update |
|
43 | 43 | * @return void |
44 | - * @throws Exception |
|
45 | - */ |
|
44 | + * @throws Exception |
|
45 | + */ |
|
46 | 46 | public function addCacheData($pCoord, PHPExcel_Cell $cell); |
47 | 47 | |
48 | - /** |
|
49 | - * Add or Update a cell in cache |
|
50 | - * |
|
51 | - * @param PHPExcel_Cell $cell Cell to update |
|
48 | + /** |
|
49 | + * Add or Update a cell in cache |
|
50 | + * |
|
51 | + * @param PHPExcel_Cell $cell Cell to update |
|
52 | 52 | * @return void |
53 | - * @throws Exception |
|
54 | - */ |
|
53 | + * @throws Exception |
|
54 | + */ |
|
55 | 55 | public function updateCacheData(PHPExcel_Cell $cell); |
56 | 56 | |
57 | - /** |
|
58 | - * Fetch a cell from cache identified by coordinate address |
|
59 | - * |
|
60 | - * @param string $pCoord Coordinate address of the cell to retrieve |
|
61 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
62 | - * @throws Exception |
|
63 | - */ |
|
57 | + /** |
|
58 | + * Fetch a cell from cache identified by coordinate address |
|
59 | + * |
|
60 | + * @param string $pCoord Coordinate address of the cell to retrieve |
|
61 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
62 | + * @throws Exception |
|
63 | + */ |
|
64 | 64 | public function getCacheData($pCoord); |
65 | 65 | |
66 | - /** |
|
67 | - * Delete a cell in cache identified by coordinate address |
|
68 | - * |
|
69 | - * @param string $pCoord Coordinate address of the cell to delete |
|
70 | - * @throws Exception |
|
71 | - */ |
|
66 | + /** |
|
67 | + * Delete a cell in cache identified by coordinate address |
|
68 | + * |
|
69 | + * @param string $pCoord Coordinate address of the cell to delete |
|
70 | + * @throws Exception |
|
71 | + */ |
|
72 | 72 | public function deleteCacheData($pCoord); |
73 | 73 | |
74 | 74 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->_storeData(); |
89 | 89 | |
90 | 90 | // Check if the entry that has been requested actually exists |
91 | - if (!isset($this->_cellCache[$pCoord])) { |
|
91 | + if ( ! isset($this->_cellCache[$pCoord])) { |
|
92 | 92 | // Return null if requested entry doesn't exist in cache |
93 | 93 | return null; |
94 | 94 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @return void |
111 | 111 | */ |
112 | 112 | public function unsetWorksheetCells() { |
113 | - if(!is_null($this->_currentObject)) { |
|
113 | + if ( ! is_null($this->_currentObject)) { |
|
114 | 114 | $this->_currentObject->detach(); |
115 | 115 | $this->_currentObject = $this->_currentObjectID = null; |
116 | 116 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return boolean |
129 | 129 | */ |
130 | 130 | public static function cacheMethodIsAvailable() { |
131 | - if (!function_exists('igbinary_serialize')) { |
|
131 | + if ( ! function_exists('igbinary_serialize')) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private $_memoryCacheSize = null; |
51 | 51 | |
52 | - /** |
|
53 | - * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | - * and the 'nullify' the current cell object |
|
55 | - * |
|
52 | + /** |
|
53 | + * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | + * and the 'nullify' the current cell object |
|
55 | + * |
|
56 | 56 | * @return void |
57 | - * @throws Exception |
|
58 | - */ |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | 59 | private function _storeData() { |
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } // function _storeData() |
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * Add or Update a cell in cache identified by coordinate address |
|
77 | - * |
|
78 | - * @param string $pCoord Coordinate address of the cell to update |
|
79 | - * @param PHPExcel_Cell $cell Cell to update |
|
75 | + /** |
|
76 | + * Add or Update a cell in cache identified by coordinate address |
|
77 | + * |
|
78 | + * @param string $pCoord Coordinate address of the cell to update |
|
79 | + * @param PHPExcel_Cell $cell Cell to update |
|
80 | 80 | * @return void |
81 | - * @throws Exception |
|
82 | - */ |
|
81 | + * @throws Exception |
|
82 | + */ |
|
83 | 83 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
84 | 84 | if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |
85 | 85 | $this->_storeData(); |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } // function addCacheData() |
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * Get cell at a specific coordinate |
|
98 | - * |
|
99 | - * @param string $pCoord Coordinate of the cell |
|
100 | - * @throws Exception |
|
101 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | - */ |
|
96 | + /** |
|
97 | + * Get cell at a specific coordinate |
|
98 | + * |
|
99 | + * @param string $pCoord Coordinate of the cell |
|
100 | + * @throws Exception |
|
101 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | + */ |
|
103 | 103 | public function getCacheData($pCoord) { |
104 | 104 | if ($pCoord === $this->_currentObjectID) { |
105 | 105 | return $this->_currentObject; |
@@ -35,27 +35,27 @@ |
||
35 | 35 | */ |
36 | 36 | class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { |
37 | 37 | |
38 | - /** |
|
39 | - * Add or Update a cell in cache identified by coordinate address |
|
40 | - * |
|
41 | - * @param string $pCoord Coordinate address of the cell to update |
|
42 | - * @param PHPExcel_Cell $cell Cell to update |
|
38 | + /** |
|
39 | + * Add or Update a cell in cache identified by coordinate address |
|
40 | + * |
|
41 | + * @param string $pCoord Coordinate address of the cell to update |
|
42 | + * @param PHPExcel_Cell $cell Cell to update |
|
43 | 43 | * @return void |
44 | - * @throws Exception |
|
45 | - */ |
|
44 | + * @throws Exception |
|
45 | + */ |
|
46 | 46 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
47 | 47 | $this->_cellCache[$pCoord] = $cell; |
48 | 48 | return $cell; |
49 | 49 | } // function addCacheData() |
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Get cell at a specific coordinate |
|
54 | - * |
|
55 | - * @param string $pCoord Coordinate of the cell |
|
56 | - * @throws Exception |
|
57 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
58 | - */ |
|
52 | + /** |
|
53 | + * Get cell at a specific coordinate |
|
54 | + * |
|
55 | + * @param string $pCoord Coordinate of the cell |
|
56 | + * @throws Exception |
|
57 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
58 | + */ |
|
59 | 59 | public function getCacheData($pCoord) { |
60 | 60 | // Check if the entry that has been requested actually exists |
61 | 61 | if (!isset($this->_cellCache[$pCoord])) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function getCacheData($pCoord) { |
60 | 60 | // Check if the entry that has been requested actually exists |
61 | - if (!isset($this->_cellCache[$pCoord])) { |
|
61 | + if ( ! isset($this->_cellCache[$pCoord])) { |
|
62 | 62 | // Return null if requested entry doesn't exist in cache |
63 | 63 | return null; |
64 | 64 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | parent::copyCellCollection($parent); |
79 | 79 | |
80 | 80 | $newCollection = array(); |
81 | - foreach($this->_cellCache as $k => &$cell) { |
|
81 | + foreach ($this->_cellCache as $k => &$cell) { |
|
82 | 82 | $newCollection[$k] = clone $cell; |
83 | 83 | $newCollection[$k]->attach($parent); |
84 | 84 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function unsetWorksheetCells() { |
96 | 96 | // Because cells are all stored as intact objects in memory, we need to detach each one from the parent |
97 | - foreach($this->_cellCache as $k => &$cell) { |
|
97 | + foreach ($this->_cellCache as $k => &$cell) { |
|
98 | 98 | $cell->detach(); |
99 | 99 | $this->_cellCache[$k] = null; |
100 | 100 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->_storeData(); |
89 | 89 | |
90 | 90 | // Check if the entry that has been requested actually exists |
91 | - if (!isset($this->_cellCache[$pCoord])) { |
|
91 | + if ( ! isset($this->_cellCache[$pCoord])) { |
|
92 | 92 | // Return null if requested entry doesn't exist in cache |
93 | 93 | return null; |
94 | 94 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @return void |
111 | 111 | */ |
112 | 112 | public function unsetWorksheetCells() { |
113 | - if(!is_null($this->_currentObject)) { |
|
113 | + if ( ! is_null($this->_currentObject)) { |
|
114 | 114 | $this->_currentObject->detach(); |
115 | 115 | $this->_currentObject = $this->_currentObjectID = null; |
116 | 116 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private $_memoryCacheSize = null; |
51 | 51 | |
52 | - /** |
|
53 | - * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | - * and the 'nullify' the current cell object |
|
55 | - * |
|
52 | + /** |
|
53 | + * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | + * and the 'nullify' the current cell object |
|
55 | + * |
|
56 | 56 | * @return void |
57 | - * @throws Exception |
|
58 | - */ |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | 59 | private function _storeData() { |
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } // function _storeData() |
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * Add or Update a cell in cache identified by coordinate address |
|
77 | - * |
|
78 | - * @param string $pCoord Coordinate address of the cell to update |
|
79 | - * @param PHPExcel_Cell $cell Cell to update |
|
75 | + /** |
|
76 | + * Add or Update a cell in cache identified by coordinate address |
|
77 | + * |
|
78 | + * @param string $pCoord Coordinate address of the cell to update |
|
79 | + * @param PHPExcel_Cell $cell Cell to update |
|
80 | 80 | * @return void |
81 | - * @throws Exception |
|
82 | - */ |
|
81 | + * @throws Exception |
|
82 | + */ |
|
83 | 83 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
84 | 84 | if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |
85 | 85 | $this->_storeData(); |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } // function addCacheData() |
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * Get cell at a specific coordinate |
|
98 | - * |
|
99 | - * @param string $pCoord Coordinate of the cell |
|
100 | - * @throws Exception |
|
101 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | - */ |
|
96 | + /** |
|
97 | + * Get cell at a specific coordinate |
|
98 | + * |
|
99 | + * @param string $pCoord Coordinate of the cell |
|
100 | + * @throws Exception |
|
101 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | + */ |
|
103 | 103 | public function getCacheData($pCoord) { |
104 | 104 | if ($pCoord === $this->_currentObjectID) { |
105 | 105 | return $this->_currentObject; |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private $_memoryCacheSize = null; |
51 | 51 | |
52 | - /** |
|
53 | - * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | - * and the 'nullify' the current cell object |
|
55 | - * |
|
52 | + /** |
|
53 | + * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | + * and the 'nullify' the current cell object |
|
55 | + * |
|
56 | 56 | * @return void |
57 | - * @throws Exception |
|
58 | - */ |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | 59 | private function _storeData() { |
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } // function _storeData() |
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * Add or Update a cell in cache identified by coordinate address |
|
77 | - * |
|
78 | - * @param string $pCoord Coordinate address of the cell to update |
|
79 | - * @param PHPExcel_Cell $cell Cell to update |
|
75 | + /** |
|
76 | + * Add or Update a cell in cache identified by coordinate address |
|
77 | + * |
|
78 | + * @param string $pCoord Coordinate address of the cell to update |
|
79 | + * @param PHPExcel_Cell $cell Cell to update |
|
80 | 80 | * @return void |
81 | - * @throws Exception |
|
82 | - */ |
|
81 | + * @throws Exception |
|
82 | + */ |
|
83 | 83 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
84 | 84 | if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |
85 | 85 | $this->_storeData(); |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } // function addCacheData() |
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * Get cell at a specific coordinate |
|
98 | - * |
|
99 | - * @param string $pCoord Coordinate of the cell |
|
100 | - * @throws Exception |
|
101 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | - */ |
|
96 | + /** |
|
97 | + * Get cell at a specific coordinate |
|
98 | + * |
|
99 | + * @param string $pCoord Coordinate of the cell |
|
100 | + * @throws Exception |
|
101 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | + */ |
|
103 | 103 | public function getCacheData($pCoord) { |
104 | 104 | if ($pCoord === $this->_currentObjectID) { |
105 | 105 | return $this->_currentObject; |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
62 | 62 | |
63 | - fseek($this->_fileHandle,0,SEEK_END); |
|
63 | + fseek($this->_fileHandle, 0, SEEK_END); |
|
64 | 64 | $offset = ftell($this->_fileHandle); |
65 | 65 | fwrite($this->_fileHandle, serialize($this->_currentObject)); |
66 | - $this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, |
|
66 | + $this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, |
|
67 | 67 | 'sz' => ftell($this->_fileHandle) - $offset |
68 | 68 | ); |
69 | 69 | $this->_currentCellIsDirty = false; |
@@ -107,15 +107,15 @@ discard block |
||
107 | 107 | $this->_storeData(); |
108 | 108 | |
109 | 109 | // Check if the entry that has been requested actually exists |
110 | - if (!isset($this->_cellCache[$pCoord])) { |
|
110 | + if ( ! isset($this->_cellCache[$pCoord])) { |
|
111 | 111 | // Return null if requested entry doesn't exist in cache |
112 | 112 | return null; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Set current entry to the requested entry |
116 | 116 | $this->_currentObjectID = $pCoord; |
117 | - fseek($this->_fileHandle,$this->_cellCache[$pCoord]['ptr']); |
|
118 | - $this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord]['sz'])); |
|
117 | + fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']); |
|
118 | + $this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz'])); |
|
119 | 119 | // Re-attach the parent worksheet |
120 | 120 | $this->_currentObject->attach($this->_parent); |
121 | 121 | |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | public function copyCellCollection(PHPExcel_Worksheet $parent) { |
134 | 134 | parent::copyCellCollection($parent); |
135 | 135 | // Open a new stream for the cell cache data |
136 | - $newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+'); |
|
136 | + $newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize, 'a+'); |
|
137 | 137 | // Copy the existing cell cache data to the new stream |
138 | - fseek($this->_fileHandle,0); |
|
139 | - while (!feof($this->_fileHandle)) { |
|
140 | - fwrite($newFileHandle,fread($this->_fileHandle, 1024)); |
|
138 | + fseek($this->_fileHandle, 0); |
|
139 | + while ( ! feof($this->_fileHandle)) { |
|
140 | + fwrite($newFileHandle, fread($this->_fileHandle, 1024)); |
|
141 | 141 | } |
142 | 142 | $this->_fileHandle = $newFileHandle; |
143 | 143 | } // function copyCellCollection() |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public function unsetWorksheetCells() { |
152 | - if(!is_null($this->_currentObject)) { |
|
152 | + if ( ! is_null($this->_currentObject)) { |
|
153 | 153 | $this->_currentObject->detach(); |
154 | 154 | $this->_currentObject = $this->_currentObjectID = null; |
155 | 155 | } |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | * @param array of mixed $arguments Additional initialisation arguments |
171 | 171 | */ |
172 | 172 | public function __construct(PHPExcel_Worksheet $parent, $arguments) { |
173 | - $this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; |
|
173 | + $this->_memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB'; |
|
174 | 174 | |
175 | 175 | parent::__construct($parent); |
176 | 176 | if (is_null($this->_fileHandle)) { |
177 | - $this->_fileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+'); |
|
177 | + $this->_fileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize, 'a+'); |
|
178 | 178 | } |
179 | 179 | } // function __construct() |
180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * Destroy this cell collection |
184 | 184 | */ |
185 | 185 | public function __destruct() { |
186 | - if (!is_null($this->_fileHandle)) { |
|
186 | + if ( ! is_null($this->_fileHandle)) { |
|
187 | 187 | fclose($this->_fileHandle); |
188 | 188 | } |
189 | 189 | $this->_fileHandle = null; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @param string $pCoord Coordinate address of the cell to update |
87 | 87 | * @param PHPExcel_Cell $cell Cell to update |
88 | - * @return void |
|
88 | + * @return PHPExcel_Cell |
|
89 | 89 | * @throws Exception |
90 | 90 | */ |
91 | 91 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private $_DBHandle = null; |
51 | 51 | |
52 | - /** |
|
53 | - * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | - * and the 'nullify' the current cell object |
|
55 | - * |
|
52 | + /** |
|
53 | + * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | + * and the 'nullify' the current cell object |
|
55 | + * |
|
56 | 56 | * @return void |
57 | - * @throws Exception |
|
58 | - */ |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | 59 | private function _storeData() { |
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | } // function _storeData() |
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * Add or Update a cell in cache identified by coordinate address |
|
73 | - * |
|
74 | - * @param string $pCoord Coordinate address of the cell to update |
|
75 | - * @param PHPExcel_Cell $cell Cell to update |
|
71 | + /** |
|
72 | + * Add or Update a cell in cache identified by coordinate address |
|
73 | + * |
|
74 | + * @param string $pCoord Coordinate address of the cell to update |
|
75 | + * @param PHPExcel_Cell $cell Cell to update |
|
76 | 76 | * @return void |
77 | - * @throws Exception |
|
78 | - */ |
|
77 | + * @throws Exception |
|
78 | + */ |
|
79 | 79 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
80 | 80 | if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |
81 | 81 | $this->_storeData(); |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | } // function addCacheData() |
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * Get cell at a specific coordinate |
|
94 | - * |
|
95 | - * @param string $pCoord Coordinate of the cell |
|
96 | - * @throws Exception |
|
97 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
98 | - */ |
|
92 | + /** |
|
93 | + * Get cell at a specific coordinate |
|
94 | + * |
|
95 | + * @param string $pCoord Coordinate of the cell |
|
96 | + * @throws Exception |
|
97 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
98 | + */ |
|
99 | 99 | public function getCacheData($pCoord) { |
100 | 100 | if ($pCoord === $this->_currentObjectID) { |
101 | 101 | return $this->_currentObject; |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | } // function isDataSet() |
149 | 149 | |
150 | 150 | |
151 | - /** |
|
152 | - * Delete a cell in cache identified by coordinate address |
|
153 | - * |
|
154 | - * @param string $pCoord Coordinate address of the cell to delete |
|
155 | - * @throws Exception |
|
156 | - */ |
|
151 | + /** |
|
152 | + * Delete a cell in cache identified by coordinate address |
|
153 | + * |
|
154 | + * @param string $pCoord Coordinate address of the cell to delete |
|
155 | + * @throws Exception |
|
156 | + */ |
|
157 | 157 | public function deleteCacheData($pCoord) { |
158 | 158 | if ($pCoord === $this->_currentObjectID) { |
159 | 159 | $this->_currentObject->detach(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
62 | 62 | |
63 | - if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) |
|
63 | + if ( ! $this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) |
|
64 | 64 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
65 | 65 | $this->_currentCellIsDirty = false; |
66 | 66 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->_storeData(); |
104 | 104 | |
105 | 105 | $query = "SELECT value FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |
106 | - $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); |
|
106 | + $cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC); |
|
107 | 107 | if ($cellResultSet === false) { |
108 | 108 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
109 | 109 | } elseif ($cellResultSet->numRows() == 0) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | // Check if the requested entry exists in the cache |
139 | 139 | $query = "SELECT id FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |
140 | - $cellResultSet = $this->_DBHandle->query($query,SQLITE_ASSOC); |
|
140 | + $cellResultSet = $this->_DBHandle->query($query, SQLITE_ASSOC); |
|
141 | 141 | if ($cellResultSet === false) { |
142 | 142 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
143 | 143 | } elseif ($cellResultSet->numRows() == 0) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | // Check if the requested entry exists in the cache |
164 | 164 | $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |
165 | - if (!$this->_DBHandle->queryExec($query)) |
|
165 | + if ( ! $this->_DBHandle->queryExec($query)) |
|
166 | 166 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
167 | 167 | |
168 | 168 | $this->_currentCellIsDirty = false; |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function getCellList() { |
178 | 178 | $query = "SELECT id FROM kvp_".$this->_TableName; |
179 | - $cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC); |
|
179 | + $cellIdsResult = $this->_DBHandle->unbufferedQuery($query, SQLITE_ASSOC); |
|
180 | 180 | if ($cellIdsResult === false) |
181 | 181 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
182 | 182 | |
183 | 183 | $cellKeys = array(); |
184 | - foreach($cellIdsResult as $row) { |
|
184 | + foreach ($cellIdsResult as $row) { |
|
185 | 185 | $cellKeys[] = $row['id']; |
186 | 186 | } |
187 | 187 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function copyCellCollection(PHPExcel_Worksheet $parent) { |
199 | 199 | // Get a new id for the new table name |
200 | - $tableName = str_replace('.','_',$this->_getUniqueID()); |
|
201 | - if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
200 | + $tableName = str_replace('.', '_', $this->_getUniqueID()); |
|
201 | + if ( ! $this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
202 | 202 | AS SELECT * FROM kvp_'.$this->_TableName)) |
203 | 203 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
204 | 204 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return void |
214 | 214 | */ |
215 | 215 | public function unsetWorksheetCells() { |
216 | - if(!is_null($this->_currentObject)) { |
|
216 | + if ( ! is_null($this->_currentObject)) { |
|
217 | 217 | $this->_currentObject->detach(); |
218 | 218 | $this->_currentObject = $this->_currentObjectID = null; |
219 | 219 | } |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | public function __construct(PHPExcel_Worksheet $parent) { |
234 | 234 | parent::__construct($parent); |
235 | 235 | if (is_null($this->_DBHandle)) { |
236 | - $this->_TableName = str_replace('.','_',$this->_getUniqueID()); |
|
236 | + $this->_TableName = str_replace('.', '_', $this->_getUniqueID()); |
|
237 | 237 | $_DBName = ':memory:'; |
238 | 238 | |
239 | 239 | $this->_DBHandle = new SQLiteDatabase($_DBName); |
240 | 240 | if ($this->_DBHandle === false) |
241 | 241 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
242 | - if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |
|
242 | + if ( ! $this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |
|
243 | 243 | throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
244 | 244 | } |
245 | 245 | } // function __construct() |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | 262 | public static function cacheMethodIsAvailable() { |
263 | - if (!function_exists('sqlite_open')) { |
|
263 | + if ( ! function_exists('sqlite_open')) { |
|
264 | 264 | return false; |
265 | 265 | } |
266 | 266 |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
62 | 62 | |
63 | - if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) |
|
64 | - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
63 | + if (!$this->_DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES('".$this->_currentObjectID."','".sqlite_escape_string(serialize($this->_currentObject))."')")) { |
|
64 | + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
65 | + } |
|
65 | 66 | $this->_currentCellIsDirty = false; |
66 | 67 | } |
67 | 68 | $this->_currentObjectID = $this->_currentObject = null; |
@@ -162,8 +163,9 @@ discard block |
||
162 | 163 | |
163 | 164 | // Check if the requested entry exists in the cache |
164 | 165 | $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |
165 | - if (!$this->_DBHandle->queryExec($query)) |
|
166 | - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
166 | + if (!$this->_DBHandle->queryExec($query)) { |
|
167 | + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
168 | + } |
|
167 | 169 | |
168 | 170 | $this->_currentCellIsDirty = false; |
169 | 171 | } // function deleteCacheData() |
@@ -177,8 +179,9 @@ discard block |
||
177 | 179 | public function getCellList() { |
178 | 180 | $query = "SELECT id FROM kvp_".$this->_TableName; |
179 | 181 | $cellIdsResult = $this->_DBHandle->unbufferedQuery($query,SQLITE_ASSOC); |
180 | - if ($cellIdsResult === false) |
|
181 | - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
182 | + if ($cellIdsResult === false) { |
|
183 | + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
184 | + } |
|
182 | 185 | |
183 | 186 | $cellKeys = array(); |
184 | 187 | foreach($cellIdsResult as $row) { |
@@ -199,8 +202,9 @@ discard block |
||
199 | 202 | // Get a new id for the new table name |
200 | 203 | $tableName = str_replace('.','_',$this->_getUniqueID()); |
201 | 204 | if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
202 | - AS SELECT * FROM kvp_'.$this->_TableName)) |
|
203 | - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
205 | + AS SELECT * FROM kvp_'.$this->_TableName)) { |
|
206 | + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
207 | + } |
|
204 | 208 | |
205 | 209 | // Copy the existing cell cache file |
206 | 210 | $this->_TableName = $tableName; |
@@ -237,10 +241,12 @@ discard block |
||
237 | 241 | $_DBName = ':memory:'; |
238 | 242 | |
239 | 243 | $this->_DBHandle = new SQLiteDatabase($_DBName); |
240 | - if ($this->_DBHandle === false) |
|
241 | - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
242 | - if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |
|
243 | - throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
244 | + if ($this->_DBHandle === false) { |
|
245 | + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
246 | + } |
|
247 | + if (!$this->_DBHandle->queryExec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
248 | + throw new Exception(sqlite_error_string($this->_DBHandle->lastError())); |
|
249 | + } |
|
244 | 250 | } |
245 | 251 | } // function __construct() |
246 | 252 |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @param string $pCoord Coordinate address of the cell to update |
87 | 87 | * @param PHPExcel_Cell $cell Cell to update |
88 | - * @return void |
|
88 | + * @return PHPExcel_Cell |
|
89 | 89 | * @throws Exception |
90 | 90 | */ |
91 | 91 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private $_DBHandle = null; |
51 | 51 | |
52 | - /** |
|
53 | - * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | - * and the 'nullify' the current cell object |
|
55 | - * |
|
52 | + /** |
|
53 | + * Store cell data in cache for the current cell object if it's "dirty", |
|
54 | + * and the 'nullify' the current cell object |
|
55 | + * |
|
56 | 56 | * @return void |
57 | - * @throws Exception |
|
58 | - */ |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | 59 | private function _storeData() { |
60 | 60 | if ($this->_currentCellIsDirty) { |
61 | 61 | $this->_currentObject->detach(); |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } // function _storeData() |
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * Add or Update a cell in cache identified by coordinate address |
|
77 | - * |
|
78 | - * @param string $pCoord Coordinate address of the cell to update |
|
79 | - * @param PHPExcel_Cell $cell Cell to update |
|
75 | + /** |
|
76 | + * Add or Update a cell in cache identified by coordinate address |
|
77 | + * |
|
78 | + * @param string $pCoord Coordinate address of the cell to update |
|
79 | + * @param PHPExcel_Cell $cell Cell to update |
|
80 | 80 | * @return void |
81 | - * @throws Exception |
|
82 | - */ |
|
81 | + * @throws Exception |
|
82 | + */ |
|
83 | 83 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
84 | 84 | if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) { |
85 | 85 | $this->_storeData(); |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | } // function addCacheData() |
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * Get cell at a specific coordinate |
|
98 | - * |
|
99 | - * @param string $pCoord Coordinate of the cell |
|
100 | - * @throws Exception |
|
101 | - * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | - */ |
|
96 | + /** |
|
97 | + * Get cell at a specific coordinate |
|
98 | + * |
|
99 | + * @param string $pCoord Coordinate of the cell |
|
100 | + * @throws Exception |
|
101 | + * @return PHPExcel_Cell Cell that was found, or null if not found |
|
102 | + */ |
|
103 | 103 | public function getCacheData($pCoord) { |
104 | 104 | if ($pCoord === $this->_currentObjectID) { |
105 | 105 | return $this->_currentObject; |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | } // function isDataSet() |
152 | 152 | |
153 | 153 | |
154 | - /** |
|
155 | - * Delete a cell in cache identified by coordinate address |
|
156 | - * |
|
157 | - * @param string $pCoord Coordinate address of the cell to delete |
|
158 | - * @throws Exception |
|
159 | - */ |
|
154 | + /** |
|
155 | + * Delete a cell in cache identified by coordinate address |
|
156 | + * |
|
157 | + * @param string $pCoord Coordinate address of the cell to delete |
|
158 | + * @throws Exception |
|
159 | + */ |
|
160 | 160 | public function deleteCacheData($pCoord) { |
161 | 161 | if ($pCoord === $this->_currentObjectID) { |
162 | 162 | $this->_currentObject->detach(); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $this->_currentObject->detach(); |
62 | 62 | |
63 | 63 | $query = $this->_DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->_TableName." VALUES(:id,:data)"); |
64 | - $query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT); |
|
65 | - $query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); |
|
64 | + $query->bindValue('id', $this->_currentObjectID, SQLITE3_TEXT); |
|
65 | + $query->bindValue('data', serialize($this->_currentObject), SQLITE3_BLOB); |
|
66 | 66 | $result = $query->execute(); |
67 | 67 | if ($result === false) |
68 | 68 | throw new Exception($this->_DBHandle->lastErrorMsg()); |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function copyCellCollection(PHPExcel_Worksheet $parent) { |
203 | 203 | // Get a new id for the new table name |
204 | - $tableName = str_replace('.','_',$this->_getUniqueID()); |
|
205 | - if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
204 | + $tableName = str_replace('.', '_', $this->_getUniqueID()); |
|
205 | + if ( ! $this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
206 | 206 | AS SELECT * FROM kvp_'.$this->_TableName)) |
207 | 207 | throw new Exception($this->_DBHandle->lastErrorMsg()); |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @return void |
218 | 218 | */ |
219 | 219 | public function unsetWorksheetCells() { |
220 | - if(!is_null($this->_currentObject)) { |
|
220 | + if ( ! is_null($this->_currentObject)) { |
|
221 | 221 | $this->_currentObject->detach(); |
222 | 222 | $this->_currentObject = $this->_currentObjectID = null; |
223 | 223 | } |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | public function __construct(PHPExcel_Worksheet $parent) { |
238 | 238 | parent::__construct($parent); |
239 | 239 | if (is_null($this->_DBHandle)) { |
240 | - $this->_TableName = str_replace('.','_',$this->_getUniqueID()); |
|
240 | + $this->_TableName = str_replace('.', '_', $this->_getUniqueID()); |
|
241 | 241 | $_DBName = ':memory:'; |
242 | 242 | |
243 | 243 | $this->_DBHandle = new SQLite3($_DBName); |
244 | 244 | if ($this->_DBHandle === false) |
245 | 245 | throw new Exception($this->_DBHandle->lastErrorMsg()); |
246 | - if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |
|
246 | + if ( ! $this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |
|
247 | 247 | throw new Exception($this->_DBHandle->lastErrorMsg()); |
248 | 248 | } |
249 | 249 | } // function __construct() |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * Destroy this cell collection |
254 | 254 | */ |
255 | 255 | public function __destruct() { |
256 | - if (!is_null($this->_DBHandle)) { |
|
256 | + if ( ! is_null($this->_DBHandle)) { |
|
257 | 257 | $this->_DBHandle->close(); |
258 | 258 | } |
259 | 259 | $this->_DBHandle = null; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return boolean |
268 | 268 | */ |
269 | 269 | public static function cacheMethodIsAvailable() { |
270 | - if (!class_exists('SQLite3')) { |
|
270 | + if ( ! class_exists('SQLite3')) { |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | $query->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT); |
65 | 65 | $query->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB); |
66 | 66 | $result = $query->execute(); |
67 | - if ($result === false) |
|
68 | - throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
67 | + if ($result === false) { |
|
68 | + throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
69 | + } |
|
69 | 70 | $this->_currentCellIsDirty = false; |
70 | 71 | } |
71 | 72 | $this->_currentObjectID = $this->_currentObject = null; |
@@ -166,8 +167,9 @@ discard block |
||
166 | 167 | // Check if the requested entry exists in the cache |
167 | 168 | $query = "DELETE FROM kvp_".$this->_TableName." WHERE id='".$pCoord."'"; |
168 | 169 | $result = $this->_DBHandle->exec($query); |
169 | - if ($result === false) |
|
170 | - throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
170 | + if ($result === false) { |
|
171 | + throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
172 | + } |
|
171 | 173 | |
172 | 174 | $this->_currentCellIsDirty = false; |
173 | 175 | } // function deleteCacheData() |
@@ -181,8 +183,9 @@ discard block |
||
181 | 183 | public function getCellList() { |
182 | 184 | $query = "SELECT id FROM kvp_".$this->_TableName; |
183 | 185 | $cellIdsResult = $this->_DBHandle->query($query); |
184 | - if ($cellIdsResult === false) |
|
185 | - throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
186 | + if ($cellIdsResult === false) { |
|
187 | + throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
188 | + } |
|
186 | 189 | |
187 | 190 | $cellKeys = array(); |
188 | 191 | while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) { |
@@ -203,8 +206,9 @@ discard block |
||
203 | 206 | // Get a new id for the new table name |
204 | 207 | $tableName = str_replace('.','_',$this->_getUniqueID()); |
205 | 208 | if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
206 | - AS SELECT * FROM kvp_'.$this->_TableName)) |
|
207 | - throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
209 | + AS SELECT * FROM kvp_'.$this->_TableName)) { |
|
210 | + throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
211 | + } |
|
208 | 212 | |
209 | 213 | // Copy the existing cell cache file |
210 | 214 | $this->_TableName = $tableName; |
@@ -241,10 +245,12 @@ discard block |
||
241 | 245 | $_DBName = ':memory:'; |
242 | 246 | |
243 | 247 | $this->_DBHandle = new SQLite3($_DBName); |
244 | - if ($this->_DBHandle === false) |
|
245 | - throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
246 | - if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) |
|
247 | - throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
248 | + if ($this->_DBHandle === false) { |
|
249 | + throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
250 | + } |
|
251 | + if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$this->_TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
252 | + throw new Exception($this->_DBHandle->lastErrorMsg()); |
|
253 | + } |
|
248 | 254 | } |
249 | 255 | } // function __construct() |
250 | 256 |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @param string $pCoord Coordinate address of the cell to update |
87 | 87 | * @param PHPExcel_Cell $cell Cell to update |
88 | - * @return void |
|
88 | + * @return PHPExcel_Cell |
|
89 | 89 | * @throws Exception |
90 | 90 | */ |
91 | 91 | public function addCacheData($pCoord, PHPExcel_Cell $cell) { |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | * @return string|NULL |
65 | 65 | * |
66 | 66 | */ |
67 | - private static function __fieldExtract($database,$field) { |
|
67 | + private static function __fieldExtract($database, $field) { |
|
68 | 68 | $field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field)); |
69 | - $fieldNames = array_map('strtoupper',array_shift($database)); |
|
69 | + $fieldNames = array_map('strtoupper', array_shift($database)); |
|
70 | 70 | |
71 | 71 | if (is_numeric($field)) { |
72 | 72 | $keys = array_keys($fieldNames); |
73 | - return $keys[$field-1]; |
|
73 | + return $keys[$field - 1]; |
|
74 | 74 | } |
75 | - $key = array_search($field,$fieldNames); |
|
75 | + $key = array_search($field, $fieldNames); |
|
76 | 76 | return ($key) ? $key : NULL; |
77 | 77 | } |
78 | 78 | |
@@ -95,53 +95,53 @@ discard block |
||
95 | 95 | * @return array of mixed |
96 | 96 | * |
97 | 97 | */ |
98 | - private static function __filter($database,$criteria) { |
|
98 | + private static function __filter($database, $criteria) { |
|
99 | 99 | $fieldNames = array_shift($database); |
100 | 100 | $criteriaNames = array_shift($criteria); |
101 | 101 | |
102 | 102 | // Convert the criteria into a set of AND/OR conditions with [:placeholders] |
103 | 103 | $testConditions = $testValues = array(); |
104 | 104 | $testConditionsCount = 0; |
105 | - foreach($criteriaNames as $key => $criteriaName) { |
|
105 | + foreach ($criteriaNames as $key => $criteriaName) { |
|
106 | 106 | $testCondition = array(); |
107 | 107 | $testConditionCount = 0; |
108 | - foreach($criteria as $row => $criterion) { |
|
108 | + foreach ($criteria as $row => $criterion) { |
|
109 | 109 | if ($criterion[$key] > '') { |
110 | 110 | $testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::_ifCondition($criterion[$key]); |
111 | 111 | $testConditionCount++; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | if ($testConditionCount > 1) { |
115 | - $testConditions[] = 'OR('.implode(',',$testCondition).')'; |
|
115 | + $testConditions[] = 'OR('.implode(',', $testCondition).')'; |
|
116 | 116 | $testConditionsCount++; |
117 | - } elseif($testConditionCount == 1) { |
|
117 | + } elseif ($testConditionCount == 1) { |
|
118 | 118 | $testConditions[] = $testCondition[0]; |
119 | 119 | $testConditionsCount++; |
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | 123 | if ($testConditionsCount > 1) { |
124 | - $testConditionSet = 'AND('.implode(',',$testConditions).')'; |
|
125 | - } elseif($testConditionsCount == 1) { |
|
124 | + $testConditionSet = 'AND('.implode(',', $testConditions).')'; |
|
125 | + } elseif ($testConditionsCount == 1) { |
|
126 | 126 | $testConditionSet = $testConditions[0]; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Loop through each row of the database |
130 | - foreach($database as $dataRow => $dataValues) { |
|
130 | + foreach ($database as $dataRow => $dataValues) { |
|
131 | 131 | // Substitute actual values from the database row for our [:placeholders] |
132 | 132 | $testConditionList = $testConditionSet; |
133 | - foreach($criteriaNames as $key => $criteriaName) { |
|
134 | - $k = array_search($criteriaName,$fieldNames); |
|
133 | + foreach ($criteriaNames as $key => $criteriaName) { |
|
134 | + $k = array_search($criteriaName, $fieldNames); |
|
135 | 135 | if (isset($dataValues[$k])) { |
136 | 136 | $dataValue = $dataValues[$k]; |
137 | 137 | $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::_wrapResult(strtoupper($dataValue)) : $dataValue; |
138 | - $testConditionList = str_replace('[:'.$criteriaName.']',$dataValue,$testConditionList); |
|
138 | + $testConditionList = str_replace('[:'.$criteriaName.']', $dataValue, $testConditionList); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | // evaluate the criteria against the row data |
142 | 142 | $result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList); |
143 | 143 | // If the row failed to meet the criteria, remove it from the database |
144 | - if (!$result) { |
|
144 | + if ( ! $result) { |
|
145 | 145 | unset($database[$dataRow]); |
146 | 146 | } |
147 | 147 | } |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | * @return float |
178 | 178 | * |
179 | 179 | */ |
180 | - public static function DAVERAGE($database,$field,$criteria) { |
|
181 | - $field = self::__fieldExtract($database,$field); |
|
180 | + public static function DAVERAGE($database, $field, $criteria) { |
|
181 | + $field = self::__fieldExtract($database, $field); |
|
182 | 182 | if (is_null($field)) { |
183 | 183 | return NULL; |
184 | 184 | } |
185 | 185 | // reduce the database to a set of rows that match all the criteria |
186 | - $database = self::__filter($database,$criteria); |
|
186 | + $database = self::__filter($database, $criteria); |
|
187 | 187 | // extract an array of values for the requested column |
188 | 188 | $colData = array(); |
189 | - foreach($database as $row) { |
|
189 | + foreach ($database as $row) { |
|
190 | 190 | $colData[] = $row[$field]; |
191 | 191 | } |
192 | 192 | |
@@ -229,17 +229,17 @@ discard block |
||
229 | 229 | * database that match the criteria. |
230 | 230 | * |
231 | 231 | */ |
232 | - public static function DCOUNT($database,$field,$criteria) { |
|
233 | - $field = self::__fieldExtract($database,$field); |
|
232 | + public static function DCOUNT($database, $field, $criteria) { |
|
233 | + $field = self::__fieldExtract($database, $field); |
|
234 | 234 | if (is_null($field)) { |
235 | 235 | return NULL; |
236 | 236 | } |
237 | 237 | |
238 | 238 | // reduce the database to a set of rows that match all the criteria |
239 | - $database = self::__filter($database,$criteria); |
|
239 | + $database = self::__filter($database, $criteria); |
|
240 | 240 | // extract an array of values for the requested column |
241 | 241 | $colData = array(); |
242 | - foreach($database as $row) { |
|
242 | + foreach ($database as $row) { |
|
243 | 243 | $colData[] = $row[$field]; |
244 | 244 | } |
245 | 245 | |
@@ -278,17 +278,17 @@ discard block |
||
278 | 278 | * database that match the criteria. |
279 | 279 | * |
280 | 280 | */ |
281 | - public static function DCOUNTA($database,$field,$criteria) { |
|
282 | - $field = self::__fieldExtract($database,$field); |
|
281 | + public static function DCOUNTA($database, $field, $criteria) { |
|
282 | + $field = self::__fieldExtract($database, $field); |
|
283 | 283 | if (is_null($field)) { |
284 | 284 | return NULL; |
285 | 285 | } |
286 | 286 | |
287 | 287 | // reduce the database to a set of rows that match all the criteria |
288 | - $database = self::__filter($database,$criteria); |
|
288 | + $database = self::__filter($database, $criteria); |
|
289 | 289 | // extract an array of values for the requested column |
290 | 290 | $colData = array(); |
291 | - foreach($database as $row) { |
|
291 | + foreach ($database as $row) { |
|
292 | 292 | $colData[] = $row[$field]; |
293 | 293 | } |
294 | 294 | |
@@ -325,17 +325,17 @@ discard block |
||
325 | 325 | * @return mixed |
326 | 326 | * |
327 | 327 | */ |
328 | - public static function DGET($database,$field,$criteria) { |
|
329 | - $field = self::__fieldExtract($database,$field); |
|
328 | + public static function DGET($database, $field, $criteria) { |
|
329 | + $field = self::__fieldExtract($database, $field); |
|
330 | 330 | if (is_null($field)) { |
331 | 331 | return NULL; |
332 | 332 | } |
333 | 333 | |
334 | 334 | // reduce the database to a set of rows that match all the criteria |
335 | - $database = self::__filter($database,$criteria); |
|
335 | + $database = self::__filter($database, $criteria); |
|
336 | 336 | // extract an array of values for the requested column |
337 | 337 | $colData = array(); |
338 | - foreach($database as $row) { |
|
338 | + foreach ($database as $row) { |
|
339 | 339 | $colData[] = $row[$field]; |
340 | 340 | } |
341 | 341 | |
@@ -376,17 +376,17 @@ discard block |
||
376 | 376 | * @return float |
377 | 377 | * |
378 | 378 | */ |
379 | - public static function DMAX($database,$field,$criteria) { |
|
380 | - $field = self::__fieldExtract($database,$field); |
|
379 | + public static function DMAX($database, $field, $criteria) { |
|
380 | + $field = self::__fieldExtract($database, $field); |
|
381 | 381 | if (is_null($field)) { |
382 | 382 | return NULL; |
383 | 383 | } |
384 | 384 | |
385 | 385 | // reduce the database to a set of rows that match all the criteria |
386 | - $database = self::__filter($database,$criteria); |
|
386 | + $database = self::__filter($database, $criteria); |
|
387 | 387 | // extract an array of values for the requested column |
388 | 388 | $colData = array(); |
389 | - foreach($database as $row) { |
|
389 | + foreach ($database as $row) { |
|
390 | 390 | $colData[] = $row[$field]; |
391 | 391 | } |
392 | 392 | |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | * @return float |
424 | 424 | * |
425 | 425 | */ |
426 | - public static function DMIN($database,$field,$criteria) { |
|
427 | - $field = self::__fieldExtract($database,$field); |
|
426 | + public static function DMIN($database, $field, $criteria) { |
|
427 | + $field = self::__fieldExtract($database, $field); |
|
428 | 428 | if (is_null($field)) { |
429 | 429 | return NULL; |
430 | 430 | } |
431 | 431 | |
432 | 432 | // reduce the database to a set of rows that match all the criteria |
433 | - $database = self::__filter($database,$criteria); |
|
433 | + $database = self::__filter($database, $criteria); |
|
434 | 434 | // extract an array of values for the requested column |
435 | 435 | $colData = array(); |
436 | - foreach($database as $row) { |
|
436 | + foreach ($database as $row) { |
|
437 | 437 | $colData[] = $row[$field]; |
438 | 438 | } |
439 | 439 | |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | * @return float |
470 | 470 | * |
471 | 471 | */ |
472 | - public static function DPRODUCT($database,$field,$criteria) { |
|
473 | - $field = self::__fieldExtract($database,$field); |
|
472 | + public static function DPRODUCT($database, $field, $criteria) { |
|
473 | + $field = self::__fieldExtract($database, $field); |
|
474 | 474 | if (is_null($field)) { |
475 | 475 | return NULL; |
476 | 476 | } |
477 | 477 | |
478 | 478 | // reduce the database to a set of rows that match all the criteria |
479 | - $database = self::__filter($database,$criteria); |
|
479 | + $database = self::__filter($database, $criteria); |
|
480 | 480 | // extract an array of values for the requested column |
481 | 481 | $colData = array(); |
482 | - foreach($database as $row) { |
|
482 | + foreach ($database as $row) { |
|
483 | 483 | $colData[] = $row[$field]; |
484 | 484 | } |
485 | 485 | |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @return float |
517 | 517 | * |
518 | 518 | */ |
519 | - public static function DSTDEV($database,$field,$criteria) { |
|
520 | - $field = self::__fieldExtract($database,$field); |
|
519 | + public static function DSTDEV($database, $field, $criteria) { |
|
520 | + $field = self::__fieldExtract($database, $field); |
|
521 | 521 | if (is_null($field)) { |
522 | 522 | return NULL; |
523 | 523 | } |
524 | 524 | |
525 | 525 | // reduce the database to a set of rows that match all the criteria |
526 | - $database = self::__filter($database,$criteria); |
|
526 | + $database = self::__filter($database, $criteria); |
|
527 | 527 | // extract an array of values for the requested column |
528 | 528 | $colData = array(); |
529 | - foreach($database as $row) { |
|
529 | + foreach ($database as $row) { |
|
530 | 530 | $colData[] = $row[$field]; |
531 | 531 | } |
532 | 532 | |
@@ -563,17 +563,17 @@ discard block |
||
563 | 563 | * @return float |
564 | 564 | * |
565 | 565 | */ |
566 | - public static function DSTDEVP($database,$field,$criteria) { |
|
567 | - $field = self::__fieldExtract($database,$field); |
|
566 | + public static function DSTDEVP($database, $field, $criteria) { |
|
567 | + $field = self::__fieldExtract($database, $field); |
|
568 | 568 | if (is_null($field)) { |
569 | 569 | return NULL; |
570 | 570 | } |
571 | 571 | |
572 | 572 | // reduce the database to a set of rows that match all the criteria |
573 | - $database = self::__filter($database,$criteria); |
|
573 | + $database = self::__filter($database, $criteria); |
|
574 | 574 | // extract an array of values for the requested column |
575 | 575 | $colData = array(); |
576 | - foreach($database as $row) { |
|
576 | + foreach ($database as $row) { |
|
577 | 577 | $colData[] = $row[$field]; |
578 | 578 | } |
579 | 579 | |
@@ -609,17 +609,17 @@ discard block |
||
609 | 609 | * @return float |
610 | 610 | * |
611 | 611 | */ |
612 | - public static function DSUM($database,$field,$criteria) { |
|
613 | - $field = self::__fieldExtract($database,$field); |
|
612 | + public static function DSUM($database, $field, $criteria) { |
|
613 | + $field = self::__fieldExtract($database, $field); |
|
614 | 614 | if (is_null($field)) { |
615 | 615 | return NULL; |
616 | 616 | } |
617 | 617 | |
618 | 618 | // reduce the database to a set of rows that match all the criteria |
619 | - $database = self::__filter($database,$criteria); |
|
619 | + $database = self::__filter($database, $criteria); |
|
620 | 620 | // extract an array of values for the requested column |
621 | 621 | $colData = array(); |
622 | - foreach($database as $row) { |
|
622 | + foreach ($database as $row) { |
|
623 | 623 | $colData[] = $row[$field]; |
624 | 624 | } |
625 | 625 | |
@@ -656,17 +656,17 @@ discard block |
||
656 | 656 | * @return float |
657 | 657 | * |
658 | 658 | */ |
659 | - public static function DVAR($database,$field,$criteria) { |
|
660 | - $field = self::__fieldExtract($database,$field); |
|
659 | + public static function DVAR($database, $field, $criteria) { |
|
660 | + $field = self::__fieldExtract($database, $field); |
|
661 | 661 | if (is_null($field)) { |
662 | 662 | return NULL; |
663 | 663 | } |
664 | 664 | |
665 | 665 | // reduce the database to a set of rows that match all the criteria |
666 | - $database = self::__filter($database,$criteria); |
|
666 | + $database = self::__filter($database, $criteria); |
|
667 | 667 | // extract an array of values for the requested column |
668 | 668 | $colData = array(); |
669 | - foreach($database as $row) { |
|
669 | + foreach ($database as $row) { |
|
670 | 670 | $colData[] = $row[$field]; |
671 | 671 | } |
672 | 672 | |
@@ -703,17 +703,17 @@ discard block |
||
703 | 703 | * @return float |
704 | 704 | * |
705 | 705 | */ |
706 | - public static function DVARP($database,$field,$criteria) { |
|
707 | - $field = self::__fieldExtract($database,$field); |
|
706 | + public static function DVARP($database, $field, $criteria) { |
|
707 | + $field = self::__fieldExtract($database, $field); |
|
708 | 708 | if (is_null($field)) { |
709 | 709 | return NULL; |
710 | 710 | } |
711 | 711 | |
712 | 712 | // reduce the database to a set of rows that match all the criteria |
713 | - $database = self::__filter($database,$criteria); |
|
713 | + $database = self::__filter($database, $criteria); |
|
714 | 714 | // extract an array of values for the requested column |
715 | 715 | $colData = array(); |
716 | - foreach($database as $row) { |
|
716 | + foreach ($database as $row) { |
|
717 | 717 | $colData[] = $row[$field]; |
718 | 718 | } |
719 | 719 |
@@ -59,30 +59,30 @@ discard block |
||
59 | 59 | */ |
60 | 60 | class PHPExcel_Calculation_FormulaToken { |
61 | 61 | /* Token types */ |
62 | - const TOKEN_TYPE_NOOP = 'Noop'; |
|
63 | - const TOKEN_TYPE_OPERAND = 'Operand'; |
|
62 | + const TOKEN_TYPE_NOOP = 'Noop'; |
|
63 | + const TOKEN_TYPE_OPERAND = 'Operand'; |
|
64 | 64 | const TOKEN_TYPE_FUNCTION = 'Function'; |
65 | 65 | const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression'; |
66 | 66 | const TOKEN_TYPE_ARGUMENT = 'Argument'; |
67 | 67 | const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix'; |
68 | 68 | const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix'; |
69 | 69 | const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix'; |
70 | - const TOKEN_TYPE_WHITESPACE = 'Whitespace'; |
|
71 | - const TOKEN_TYPE_UNKNOWN = 'Unknown'; |
|
70 | + const TOKEN_TYPE_WHITESPACE = 'Whitespace'; |
|
71 | + const TOKEN_TYPE_UNKNOWN = 'Unknown'; |
|
72 | 72 | |
73 | 73 | /* Token subtypes */ |
74 | - const TOKEN_SUBTYPE_NOTHING = 'Nothing'; |
|
75 | - const TOKEN_SUBTYPE_START = 'Start'; |
|
74 | + const TOKEN_SUBTYPE_NOTHING = 'Nothing'; |
|
75 | + const TOKEN_SUBTYPE_START = 'Start'; |
|
76 | 76 | const TOKEN_SUBTYPE_STOP = 'Stop'; |
77 | 77 | const TOKEN_SUBTYPE_TEXT = 'Text'; |
78 | - const TOKEN_SUBTYPE_NUMBER = 'Number'; |
|
79 | - const TOKEN_SUBTYPE_LOGICAL = 'Logical'; |
|
78 | + const TOKEN_SUBTYPE_NUMBER = 'Number'; |
|
79 | + const TOKEN_SUBTYPE_LOGICAL = 'Logical'; |
|
80 | 80 | const TOKEN_SUBTYPE_ERROR = 'Error'; |
81 | 81 | const TOKEN_SUBTYPE_RANGE = 'Range'; |
82 | - const TOKEN_SUBTYPE_MATH = 'Math'; |
|
83 | - const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation'; |
|
84 | - const TOKEN_SUBTYPE_INTERSECTION = 'Intersection'; |
|
85 | - const TOKEN_SUBTYPE_UNION = 'Union'; |
|
82 | + const TOKEN_SUBTYPE_MATH = 'Math'; |
|
83 | + const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation'; |
|
84 | + const TOKEN_SUBTYPE_INTERSECTION = 'Intersection'; |
|
85 | + const TOKEN_SUBTYPE_UNION = 'Union'; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Value |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) |
116 | 116 | { |
117 | 117 | // Initialise values |
118 | - $this->_value = $pValue; |
|
119 | - $this->_tokenType = $pTokenType; |
|
120 | - $this->_tokenSubType = $pTokenSubType; |
|
118 | + $this->_value = $pValue; |
|
119 | + $this->_tokenType = $pTokenType; |
|
120 | + $this->_tokenSubType = $pTokenSubType; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -105,72 +105,72 @@ |
||
105 | 105 | */ |
106 | 106 | private $_tokenSubType; |
107 | 107 | |
108 | - /** |
|
109 | - * Create a new PHPExcel_Calculation_FormulaToken |
|
110 | - * |
|
111 | - * @param string $pValue |
|
112 | - * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) |
|
113 | - * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) |
|
114 | - */ |
|
115 | - public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) |
|
116 | - { |
|
117 | - // Initialise values |
|
118 | - $this->_value = $pValue; |
|
119 | - $this->_tokenType = $pTokenType; |
|
120 | - $this->_tokenSubType = $pTokenSubType; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * Get Value |
|
125 | - * |
|
126 | - * @return string |
|
127 | - */ |
|
128 | - public function getValue() { |
|
129 | - return $this->_value; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Set Value |
|
134 | - * |
|
135 | - * @param string $value |
|
136 | - */ |
|
137 | - public function setValue($value) { |
|
138 | - $this->_value = $value; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * Get Token Type (represented by TOKEN_TYPE_*) |
|
143 | - * |
|
144 | - * @return string |
|
145 | - */ |
|
146 | - public function getTokenType() { |
|
147 | - return $this->_tokenType; |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * Set Token Type |
|
152 | - * |
|
153 | - * @param string $value |
|
154 | - */ |
|
155 | - public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { |
|
156 | - $this->_tokenType = $value; |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Get Token SubType (represented by TOKEN_SUBTYPE_*) |
|
161 | - * |
|
162 | - * @return string |
|
163 | - */ |
|
164 | - public function getTokenSubType() { |
|
165 | - return $this->_tokenSubType; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Set Token SubType |
|
170 | - * |
|
171 | - * @param string $value |
|
172 | - */ |
|
173 | - public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { |
|
174 | - $this->_tokenSubType = $value; |
|
175 | - } |
|
108 | + /** |
|
109 | + * Create a new PHPExcel_Calculation_FormulaToken |
|
110 | + * |
|
111 | + * @param string $pValue |
|
112 | + * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) |
|
113 | + * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) |
|
114 | + */ |
|
115 | + public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) |
|
116 | + { |
|
117 | + // Initialise values |
|
118 | + $this->_value = $pValue; |
|
119 | + $this->_tokenType = $pTokenType; |
|
120 | + $this->_tokenSubType = $pTokenSubType; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * Get Value |
|
125 | + * |
|
126 | + * @return string |
|
127 | + */ |
|
128 | + public function getValue() { |
|
129 | + return $this->_value; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Set Value |
|
134 | + * |
|
135 | + * @param string $value |
|
136 | + */ |
|
137 | + public function setValue($value) { |
|
138 | + $this->_value = $value; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Get Token Type (represented by TOKEN_TYPE_*) |
|
143 | + * |
|
144 | + * @return string |
|
145 | + */ |
|
146 | + public function getTokenType() { |
|
147 | + return $this->_tokenType; |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * Set Token Type |
|
152 | + * |
|
153 | + * @param string $value |
|
154 | + */ |
|
155 | + public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { |
|
156 | + $this->_tokenType = $value; |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Get Token SubType (represented by TOKEN_SUBTYPE_*) |
|
161 | + * |
|
162 | + * @return string |
|
163 | + */ |
|
164 | + public function getTokenSubType() { |
|
165 | + return $this->_tokenSubType; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Set Token SubType |
|
170 | + * |
|
171 | + * @param string $value |
|
172 | + */ |
|
173 | + public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { |
|
174 | + $this->_tokenSubType = $value; |
|
175 | + } |
|
176 | 176 | } |