123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Yr\Forecast\Tabular\Time;
- class Symbol implements DiffInterface {
- private $number;
- private $numberEx;
- private $name;
- private $var;
- public function __construct(\SimpleXMLElement $xml) {
- $this->number = (int)$xml['number'];
- $this->numberEx = (int)$xml['numberEx'];
- $this->name = (string)$xml['name'];
- $this->var = (string)$xml['var'];
- }
- public function getNumber(): int {
- return $this->number;
- }
- public function getName(): string {
- return $this->name;
- }
- public function getVar(): string {
- return $this->var;
- }
- public function diff(DiffInterface $s): bool {
- if ($s instanceof Symbol)
- return $this->number != $s->getNumber();
- return false;
- }
- public function __toString(): string {
- return sprintf(
- "%s (%d, %d, %s)", $this->name,
- $this->number, $this->numberEx,
- $this->var
- );
- }
- }
|