Passed
Pull Request — master (#4404)
by Owen
20:34
created

MySpreadsheet   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
dl 0
loc 12
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A calcSquare() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
6
7
use PhpOffice\PhpSpreadsheet\Spreadsheet;
8
9
class MySpreadsheet extends Spreadsheet
10
{
11
    public function calcSquare(string $cellAddress): float|int|string
12
    {
13
        $value = $this->getActiveSheet()
14
            ->getCell($cellAddress)
15
            ->getValue();
16
        if (is_numeric($value)) {
17
            return $value * $value;
18
        }
19
20
        return '#VALUE!';
21
    }
22
}
23