public function withContents(array $contents) { $this->contents = $contents; // Check if it's an array of arrays $this->list = isset($contents[0]); return $this; }
/** * Get the body of the contents array * * @param array $contents * @return string * @throws MediaObjectException if the body key has not been set */ protected function getBody(array $contents) { if (!isset($contents['body'])) { throw new MediaObjectException('You must pass in the body to each object'); } $string = $contents['body']; if (isset($contents['nest'])) { $object = new MediaObject(); $string .= $object->withContents($contents['nest']); } return $string; }