2
2
3
3
namespace PhpOffice \PhpSpreadsheet \Calculation \LookupRef ;
4
4
5
- use PhpOffice \PhpSpreadsheet \Calculation \ArrayEnabled ;
5
+ use PhpOffice \PhpSpreadsheet \Calculation \Functions ;
6
6
use PhpOffice \PhpSpreadsheet \Calculation \Information \ExcelError ;
7
7
use PhpOffice \PhpSpreadsheet \Cell \Coordinate ;
8
8
9
9
class Address
10
10
{
11
- use ArrayEnabled;
12
-
13
11
public const ADDRESS_ABSOLUTE = 1 ;
14
12
public const ADDRESS_COLUMN_RELATIVE = 2 ;
15
13
public const ADDRESS_ROW_RELATIVE = 3 ;
@@ -27,44 +25,26 @@ class Address
27
25
* =ADDRESS(row, column, [relativity], [referenceStyle], [sheetText])
28
26
*
29
27
* @param mixed $row Row number (integer) to use in the cell reference
30
- * Or can be an array of values
31
28
* @param mixed $column Column number (integer) to use in the cell reference
32
- * Or can be an array of values
33
29
* @param mixed $relativity Integer flag indicating the type of reference to return
34
30
* 1 or omitted Absolute
35
31
* 2 Absolute row; relative column
36
32
* 3 Relative row; absolute column
37
33
* 4 Relative
38
- * Or can be an array of values
39
34
* @param mixed $referenceStyle A logical (boolean) value that specifies the A1 or R1C1 reference style.
40
35
* TRUE or omitted ADDRESS returns an A1-style reference
41
36
* FALSE ADDRESS returns an R1C1-style reference
42
- * Or can be an array of values
43
37
* @param mixed $sheetName Optional Name of worksheet to use
44
- * Or can be an array of values
45
38
*
46
- * @return array|string
47
- * If an array of values is passed as the $testValue argument, then the returned result will also be
48
- * an array with the same dimensions
39
+ * @return string
49
40
*/
50
41
public static function cell ($ row , $ column , $ relativity = 1 , $ referenceStyle = true , $ sheetName = '' )
51
42
{
52
- if (
53
- is_array ($ row ) || is_array ($ column ) ||
54
- is_array ($ relativity ) || is_array ($ referenceStyle ) || is_array ($ sheetName )
55
- ) {
56
- return self ::evaluateArrayArguments (
57
- [self ::class, __FUNCTION__ ],
58
- $ row ,
59
- $ column ,
60
- $ relativity ,
61
- $ referenceStyle ,
62
- $ sheetName
63
- );
64
- }
65
-
66
- $ relativity = $ relativity ?? 1 ;
67
- $ referenceStyle = $ referenceStyle ?? true ;
43
+ $ row = Functions::flattenSingleValue ($ row );
44
+ $ column = Functions::flattenSingleValue ($ column );
45
+ $ relativity = ($ relativity === null ) ? 1 : Functions::flattenSingleValue ($ relativity );
46
+ $ referenceStyle = ($ referenceStyle === null ) ? true : Functions::flattenSingleValue ($ referenceStyle );
47
+ $ sheetName = Functions::flattenSingleValue ($ sheetName );
68
48
69
49
if (($ row < 1 ) || ($ column < 1 )) {
70
50
return ExcelError::VALUE ();
0 commit comments