You are here

public function Complex::__construct in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/unitTests/custom/Complex.php \Complex::__construct()

File

vendor/phpoffice/phpexcel/unitTests/custom/Complex.php, line 62

Class

Complex

Code

public function __construct($realPart, $imaginaryPart = null, $suffix = 'i') {
  if ($imaginaryPart === null) {
    if (is_array($realPart)) {

      //	We have an array of (potentially) real and imaginary parts, and any suffix
      list($realPart, $imaginaryPart, $suffix) = array_values($realPart) + array(
        0.0,
        0.0,
        'i',
      );
    }
    elseif (is_string($realPart) || is_numeric($realPart)) {

      //	We've been given a string to parse to extract the real and imaginary parts, and any suffix
      list($realPart, $imaginaryPart, $suffix) = self::_parseComplex($realPart);
    }
  }

  //	Set parsed values in our properties
  $this->realPart = (double) $realPart;
  $this->imaginaryPart = (double) $imaginaryPart;
  $this->suffix = strtolower($suffix);
}