Url.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. /**
  3. * This file is part of the League.url library
  4. *
  5. * @license http://opensource.org/licenses/MIT
  6. * @link https://github.com/thephpleague/url/
  7. * @version 3.3.5
  8. * @package League.url
  9. *
  10. * For the full copyright and license information, please view the LICENSE
  11. * file that was distributed with this source code.
  12. */
  13. namespace League\Url;
  14. /**
  15. * A class to manipulate URLs
  16. *
  17. * @package League.url
  18. * @since 1.0.0
  19. */
  20. class Url extends AbstractUrl
  21. {
  22. /**
  23. * The Constructor
  24. * @param Components\Scheme $scheme The URL Scheme component
  25. * @param Components\User $user The URL User component
  26. * @param Components\Pass $pass The URL Pass component
  27. * @param Components\HostInterface $host The URL Host component
  28. * @param Components\Port $port The URL Port component
  29. * @param Components\PathInterface $path The URL Path component
  30. * @param Components\QueryInterface $query The URL Query component
  31. * @param Components\Fragment $fragment The URL Fragment component
  32. */
  33. protected function __construct(
  34. Components\Scheme $scheme,
  35. Components\User $user,
  36. Components\Pass $pass,
  37. Components\HostInterface $host,
  38. Components\Port $port,
  39. Components\PathInterface $path,
  40. Components\QueryInterface $query,
  41. Components\Fragment $fragment
  42. ) {
  43. $this->scheme = $scheme;
  44. $this->user = $user;
  45. $this->pass = $pass;
  46. $this->host = $host;
  47. $this->port = $port;
  48. $this->path = $path;
  49. $this->query = $query;
  50. $this->fragment = $fragment;
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function setScheme($data)
  56. {
  57. $this->scheme->set($data);
  58. return $this;
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function getScheme()
  64. {
  65. return $this->scheme;
  66. }
  67. /**
  68. * {@inheritdoc}
  69. */
  70. public function setUser($data)
  71. {
  72. $this->user->set($data);
  73. return $this;
  74. }
  75. /**
  76. * {@inheritdoc}
  77. */
  78. public function getUser()
  79. {
  80. return $this->user;
  81. }
  82. /**
  83. * {@inheritdoc}
  84. */
  85. public function setPass($data)
  86. {
  87. $this->pass->set($data);
  88. return $this;
  89. }
  90. /**
  91. * {@inheritdoc}
  92. */
  93. public function getPass()
  94. {
  95. return $this->pass;
  96. }
  97. /**
  98. * {@inheritdoc}
  99. */
  100. public function setHost($data)
  101. {
  102. $this->host->set($data);
  103. return $this;
  104. }
  105. /**
  106. * {@inheritdoc}
  107. */
  108. public function getHost()
  109. {
  110. return $this->host;
  111. }
  112. /**
  113. * {@inheritdoc}
  114. */
  115. public function setPort($data)
  116. {
  117. $this->port->set($data);
  118. return $this;
  119. }
  120. /**
  121. * {@inheritdoc}
  122. */
  123. public function getPort()
  124. {
  125. return $this->port;
  126. }
  127. /**
  128. * {@inheritdoc}
  129. */
  130. public function setPath($data)
  131. {
  132. $this->path->set($data);
  133. return $this;
  134. }
  135. /**
  136. * {@inheritdoc}
  137. */
  138. public function getPath()
  139. {
  140. return $this->path;
  141. }
  142. /**
  143. * {@inheritdoc}
  144. */
  145. public function setQuery($data)
  146. {
  147. $this->query->set($data);
  148. return $this;
  149. }
  150. /**
  151. * {@inheritdoc}
  152. */
  153. public function getQuery()
  154. {
  155. return $this->query;
  156. }
  157. /**
  158. * {@inheritdoc}
  159. */
  160. public function setFragment($data)
  161. {
  162. $this->fragment->set($data);
  163. return $this;
  164. }
  165. /**
  166. * {@inheritdoc}
  167. */
  168. public function getFragment()
  169. {
  170. return $this->fragment;
  171. }
  172. }