Get path from string or via a closure.

@return string

@SuppressWarnings(PHPMD.ExitExpression)
199499
private function getPath()
    {
        if (($path = $this->config['path']) instanceof \Closure) {
            $this->line('Generating dynamic download path.');
            $this->line('');
            if (is_numeric($path = $path($this))) {
                exit($path);
            }
            $this->line('');
        }

        if (!is_string($path)) {
            $this->error('Path has not been provided as a string.');
            $this->line('');
            $this->line('');

            exit(1);
        }

        return $path;
    }
6421
public function getPath()
    {
        if($this->getType() == 'memory') {
            $this->_path = parse_url($this->_path, PHP_URL_PATH);
        }

        if($this->getType() == 'temp')
        {
            if(!$this->getResource()) {
                $this->_path = $this->getTemporaryFile();
            }
        }

        return parent::getPath();
    }
1182575
public function getRelativePath()
    {
        return trim(substr($this->path, strlen($this->basePath)), self::TRIM_CHARS);
    }
1359537
public static function getPath(string $path): string {
		$e = explode("/", $path);
		unset($e[count($e) - 1]);

		return implode("/", $e);
	}
1242774
public function getPath()
    {
        $node = $this;
        $path = [];

        while (true) {
            $path[] = $node["name"];
            if ($node->isRoot()) {
                break;
            }

            $node = self::loadById($node["parents"][0]);
            if (is_null($node)) {
                throw new \Exception("No parent node found with ID {$node['parents'][0]}.");
            }

            if ($node->isRoot()) {
                break;
            }
        }

        $path = array_reverse($path);

        return implode('/', $path);
    }
1161941
private function getCLIPath()
    {
        $command = '';
        if (!is_null($this->path)) {
            $command .= sprintf(' -- %s', escapeshellarg($this->path));
        }
        return $command;
    }
202401
public String getPath() {
    // FIXME: This is sloppy/icky
    if (isRoot()) {
      return ROOT;
    }
    if (getParent().isRoot()) {
      return String.format("%s%s", ROOT, getName());
    }
    return String.format("%s%s%s", getParent().getPath(), SEPARATOR, getName());
  }
1307678
public function pathInfo() {
        $url = $this->url();
        $index = strpos($url, "?");
        if ($index) {
            $url = substr($url, 0, $index);
        }

        return $url;
    }
1117525
private function getPath($path)
    {
        if ($this->basePath === '' || strpos($path, $this->basePath) === 0) {
            $path = substr($path, strlen($this->basePath)) ?: '';
        }

        return $path === '' ? '/' : $path;
    }
866233
public function getPath()
	{
		$path = getcwd() . DIRECTORY_SEPARATOR . $this->path;

		if (substr($this->path, 0, 1) == '/' || substr($this->path, 1, 1) == ':') {
			$path = $this->path;
		}

		return realpath($path);
	}
1204975
public function getPath() {
    $path = '';
    /** @var TokenNode $child */
    $child = $this->head;
    while ($child) {
      $type = $child->getType();
      if ($type === T_NAMESPACE || $type === T_NS_SEPARATOR || $type === T_STRING) {
        $path .= $child->getText();
      }
      $child = $child->next;
    }
    return $path;
  }
1237585
function toString()
    {
        $path   = $this->getPath();
        if (empty($path))
            return '';

        $DS = $this->getSeparator();

        if ($path == array($DS))
            // its home, implode not working for one element
            return $DS;

        // TODO conflict with classes that extends this; we have to use self to call this class method not parent implementation for method
        if (self::isAbsolute() && $path[0] == $this->getSeparator() /* unix style */) {
            // in specific case "//df" implode result in "///df"
            unset($path[0]);
            $return = $this->getSeparator().implode( $this->getSeparator(), $path );
        } else {
            $return = implode( $this->getSeparator(), $path );
        }

        return $return;
    }
773481
public function getPath()
    {
        $sname = '';
        $gname = '';
        $vname = $this->getName();
        if ( $this->getConfigGroup() ) {
            if ( $this->getConfigGroup()->getConfigSection() ) {
                $sname = $this->getConfigGroup()->getConfigSection()->getName();
            }
            $gname = $this->getConfigGroup()->getName();
        }

        return sprintf(
            '%s:%s:%s',
            $sname,
            $gname,
            $vname
        );
    }
48939
public function Path($Path = NULL) {
      if (is_string($Path)) {
         $Result = $this->_ParsedRequestElement('Path', $Path);
      } else {
         $Result = $this->_ParsedRequestElement('Path');
         if ($Path === TRUE) {
            // Encode the path.
            $Parts = explode('/', $Result);
            $Parts = array_map('urlencode', $Parts);
            $Result = implode('/', $Parts);
         }
      }
      
      return $Result;
   }
1004555
function getPath()
    {
        if ( $this->Path !== null )
            return $this->Path;

        // Fetch path 'text' elements of correct parent path
        $path = array( $this->Text );
        $id = (int)$this->Parent;
        $db = eZDB::instance();
        while ( $id != 0 )
        {
            $query = "SELECT parent, lang_mask, text FROM ezurlalias_ml WHERE id={$id}";
            $rows = $db->arrayQuery( $query );
            if ( count( $rows ) == 0 )
            {
                break;
            }
            $result = eZURLAliasML::choosePrioritizedRow( $rows );
            if ( !$result )
            {
                $result = $rows[0];
            }
            $id = (int)$result['parent'];
            array_unshift( $path, $result['text'] );
        }
        $this->Path = implode( '/', $path );
        return $this->Path;
    }
1064154
public function getPathInfo()
    {
        if ($this->pathInfo === null) {
            $end = strpos($this->uri, '?');

            if ($end === false) {
                $this->pathInfo = $this->uri;
            }else{
                $this->pathInfo = substr($this->uri, 0, $end);
            }

            if (empty($this->pathInfo)) {
                $this->pathInfo = '/';
            }
        }
        
        return $this->pathInfo;
    }
1276827
public function getPath()
    {
        if (!$this->_path) {
            $this->_path = $this->detectPath($this->name);
        }

        return $this->_path;
    }