protected function fromSegment($object, MessageSegment $segment) { $classRefl = new \ReflectionClass($object); // Check if proper segment was received $this->checkSegmentCode($classRefl, $segment->getCode()); // Populate SegmentPiece properties $this->fillFromArray($object, $classRefl, array_values($segment->getRawData())); // Check if mandatory fields have values $this->checkMandatoryFields($object, $classRefl, $segment->getCode()); }
public function acceptSegment(Segment $segment) { if ($this->getCode() == $segment->getCode() && $this->maxRepeat > count($this->segments)) { $this->segments[] = $segment; return true; } else { return false; } }