Passed
Push — master ( 74dca3...bb3d5f )
by
unknown
23:51 queued 13:47
created

MySpreadsheet::calcSquare()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 1
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