/**
  * Constructs an instance of this class.
  *
  * @param Unit   $parent
  * @param string $symbol
  * @param string $quantity
  */
 public function __construct(Unit $parent, $symbol, $quantity)
 {
     if (!$parent->isStandardUnit()) {
         throw new \InvalidArgumentException(sprintf('Parent unit "%s" is not a standard unit.', $parent->getSymbol()));
     }
     parent::__construct($quantity);
     $this->parent = $parent;
     $this->symbol = $symbol;
 }
 /**
  * Constructs an instance of this class.
  *
  * @param CompoundElement[]|Unit $elements
  * @param string                 $quantity
  * @param string                 $symbol
  */
 public function __construct($elements, $quantity = '', $symbol = '')
 {
     parent::__construct($quantity);
     $this->symbol = $symbol;
     if ($elements instanceof self) {
         $this->elements = $elements->elements;
     } elseif (is_array($elements)) {
         $this->elements = $elements;
     } else {
         throw new \InvalidArgumentException(sprintf('Expected a ProductUnit or an array of CompoundElement but got "%s"', get_class($elements)));
     }
 }