/Nette/Http/UrlScript.php
PHP | 89 lines | 26 code | 19 blank | 44 comment | 0 complexity | 1a176b13d982efd8db3c48a753d8bcb5 MD5 | raw file
Possible License(s): BSD-3-Clause
- <?php
- /**
- * This file is part of the Nette Framework (http://nette.org)
- *
- * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
- *
- * For the full copyright and license information, please view
- * the file license.txt that was distributed with this source code.
- */
- namespace Nette\Http;
- use Nette;
- /**
- * Extended HTTP URL.
- *
- * <pre>
- * http://nette.org/admin/script.php/pathinfo/?name=param#fragment
- * \_______________/\________/
- * | |
- * scriptPath pathInfo
- * </pre>
- *
- * - scriptPath: /admin/script.php (or simply /admin/ when script is directory index)
- * - pathInfo: /pathinfo/ (additional path information)
- *
- * @author David Grudl
- *
- * @property string $scriptPath
- * @property-read string $pathInfo
- */
- class UrlScript extends Url
- {
- /** @var string */
- private $scriptPath = '/';
- /**
- * Sets the script-path part of URI.
- * @param string
- * @return UrlScript provides a fluent interface
- */
- public function setScriptPath($value)
- {
- $this->updating();
- $this->scriptPath = (string) $value;
- return $this;
- }
- /**
- * Returns the script-path part of URI.
- * @return string
- */
- public function getScriptPath()
- {
- return $this->scriptPath;
- }
- /**
- * Returns the base-path.
- * @return string
- */
- public function getBasePath()
- {
- $pos = strrpos($this->scriptPath, '/');
- return $pos === FALSE ? '' : substr($this->path, 0, $pos + 1);
- }
- /**
- * Returns the additional path information.
- * @return string
- */
- public function getPathInfo()
- {
- return (string) substr($this->path, strlen($this->scriptPath));
- }
- }