This commit is contained in:
wangjinlei
2024-07-17 09:23:45 +08:00
parent edf9deeb1a
commit 881ac3e056
1001 changed files with 41032 additions and 5452 deletions

View File

@@ -0,0 +1,7 @@
<?php
namespace PhpOffice\Math\Element;
abstract class AbstractElement
{
}

View File

@@ -0,0 +1,35 @@
<?php
namespace PhpOffice\Math\Element;
abstract class AbstractGroupElement extends AbstractElement
{
/**
* @var AbstractElement[]
*/
protected $elements = [];
public function add(AbstractElement $element): self
{
$this->elements[] = $element;
return $this;
}
public function remove(AbstractElement $element): self
{
$this->elements = array_filter($this->elements, function ($child) use ($element) {
return $child != $element;
});
return $this;
}
/**
* @return AbstractElement[]
*/
public function getElements(): array
{
return $this->elements;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace PhpOffice\Math\Element;
class Fraction extends AbstractElement
{
/**
* @var AbstractElement
*/
protected $denominator;
/**
* @var AbstractElement
*/
protected $numerator;
public function __construct(AbstractElement $numerator, AbstractElement $denominator)
{
$this->setNumerator($numerator);
$this->setDenominator($denominator);
}
public function getDenominator(): AbstractElement
{
return $this->denominator;
}
public function getNumerator(): AbstractElement
{
return $this->numerator;
}
public function setDenominator(AbstractElement $element): self
{
$this->denominator = $element;
return $this;
}
public function setNumerator(AbstractElement $element): self
{
$this->numerator = $element;
return $this;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace PhpOffice\Math\Element;
class Identifier extends AbstractElement
{
/**
* @var string
*/
protected $value;
public function __construct(string $value)
{
$this->value = $value;
}
public function getValue(): string
{
return $this->value;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace PhpOffice\Math\Element;
class Numeric extends AbstractElement
{
/**
* @var float
*/
protected $value;
public function __construct(float $value)
{
$this->value = $value;
}
public function getValue(): float
{
return $this->value;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace PhpOffice\Math\Element;
class Operator extends AbstractElement
{
/**
* @var string
*/
protected $value;
public function __construct(string $value)
{
$this->value = $value;
}
public function getValue(): string
{
return $this->value;
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace PhpOffice\Math\Element;
class Row extends AbstractGroupElement
{
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace PhpOffice\Math\Element;
class Semantics extends AbstractGroupElement
{
/**
* @var array<string, string>
*/
protected $annotations = [];
public function addAnnotation(string $encoding, string $annotation): self
{
$this->annotations[$encoding] = $annotation;
return $this;
}
public function getAnnotation(string $encoding): ?string
{
return $this->annotations[$encoding] ?? null;
}
/**
* @return array<string, string>
*/
public function getAnnotations(): array
{
return $this->annotations;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace PhpOffice\Math\Element;
class Superscript extends AbstractElement
{
/**
* @var AbstractElement
*/
protected $base;
/**
* @var AbstractElement
*/
protected $superscript;
public function __construct(AbstractElement $base, AbstractElement $superscript)
{
$this->setBase($base);
$this->setSuperscript($superscript);
}
public function getBase(): AbstractElement
{
return $this->base;
}
public function getSuperscript(): AbstractElement
{
return $this->superscript;
}
public function setBase(AbstractElement $element): self
{
$this->base = $element;
return $this;
}
public function setSuperscript(AbstractElement $element): self
{
$this->superscript = $element;
return $this;
}
}