loadData($data); return $part; } /** * {@inheritdoc} */ public function getPartNumber() { return $this->partNumber; } /** * {@inheritdoc} */ public function toArray() { $array = array(); foreach (static::$keyMap as $key => $property) { $array[$key] = $this->{$property}; } return $array; } /** * {@inheritdoc} */ public function serialize() { return serialize($this->toArray()); } /** * {@inheritdoc} */ public function unserialize($serialized) { $this->loadData(unserialize($serialized)); } /** * Loads an array of data into the upload part by extracting only the needed keys * * @param array|\Traversable $data Data to load into the upload part value object * * @throws InvalidArgumentException if a required key is missing */ protected function loadData($data) { foreach (static::$keyMap as $key => $property) { if (isset($data[$key])) { $this->{$property} = $data[$key]; } else { throw new InvalidArgumentException("A required key [$key] was missing from the upload part."); } } } }