* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * */ namespace libgpx; /** * A link to an external resource (Web page, digital photo, video clip, etc) * with additional information. * * @see https://www.topografix.com/GPX/1/1/#type_linkType * * @author Andy Street */ class Link { /** * URL of hyperlink. * * @var string */ protected $href; /** * Text of hyperlink. * * @var string */ protected $text; /** * Mime type of content (image/jpeg). * * @var string */ protected $type; /** * Create a new link. * * @param string $href The URL of the link. */ public function __construct(string $href) { $this->setHref($href); } /** * Fetch the URL of the link. * * @return string */ public function getHref() { return $this->href; } /** * Set the URL of the link. * * @param string $href The URL of the link. * @return void */ public function setHref(string $href) { $this->href = $href; } /** * Fetch the text of the hyperlink. * * @return string|null The text or null if not set. */ public function getText() { return $this->text; } /** * Set the text of the hyperlink. * * @param string|null $text The text of the link or null to delete. * @return void */ public function setText(string $text = null) { $this->text = $text; } /** * Fetch the mime type of the hyperlink. * * @return string|null The mime type or null if not set. */ public function getType() { return $this->type; } /** * Set the mime type of the hyperlink. * * @param string|null $type The mime type of the link or null to delete. * @return void */ public function setType(string $type = null) { $this->type = $type; } }