segment; } public function setSegment(Segment $segment) { $this->segment = $segment; } public function getPeriods() { return $this->periods; } public function setPeriods($periods) { $this->periods = $this->getAsNonEmptyArray($periods, 'periods'); } public function getIdSites() { return $this->idSites; } public function setIdSites($idSites) { $this->idSites = $this->getAsNonEmptyArray($idSites, 'idSites'); } private function getAsNonEmptyArray($array, $paramName) { if (!is_array($array)) { $array = array($array); } if (empty($array)) { throw new Exception("Archive::__construct: \$$paramName is empty."); } return $array; } }