@param string $link

@return array
@author Maximilian Ruta <mr@xtain.net>
184460
public static function parseParameters($link)
    {
        $pos = strpos($link, '?');
        if ($pos !== null) {
            $link = substr($link, $pos + 1);
        }

        $params = [];
        parse_str($link, $params);

        return $params;
    }
839184
private function scrapeCategoryList($link) {
    $source = $this->getDaxkoPageSource($link);
    $this->crawler->clear();
    $this->crawler->addHtmlContent($source);
    $list = $this->crawler->filter('div.two-column-container ul li a');
    $items = $list->each(function ($list_item) {
      return [
        'id' => $this->getQueryParam('category_ids', $list_item->attr('href')),
        'title' => $list_item->text(),
      ];
    });

    // Make the array developer friendly.
    $result = [];
    foreach ($items as $item) {
      if ($item['id']) {
        $result[$item['id']] = $item['title'];
      }
    }

    return $result;
  }
117331
public function getLinks(int $limit = 0): array
    {
        if ($this->links === null) {
            $links = $this->attrs['links'] ?? [];
            $this->links = $this->removeInvalidOrHiddenLinks($links);
        }

        return $limit > 0 ? array_slice($this->links, 0, $limit) : $this->links;
    }
142463
public function activeLink($link)
    {
        $pathinfo = $this->getPathInfo();
        if (($pathinfo and '/' . $pathinfo === $link) or (!$pathinfo and $link === '/')) {
            return ' active'; //the white space is nedded
        }

        return '';
    }
967291
protected function groupBySide($links)
    {
        $data = ['left' => [], 'right' => []];

        /** @var NavLink $link */
        foreach ($links as $link) {
            $data[$link['side']][] = $link;
        }

        return $data;
    }
118346
public function get_links(string $id): ?array
  {
    return $this->_get_links($id, $this->id_user, $this->id_group);
  }
1116779
public static function title($link) {
        if(isset($link['title']) || isset($link['label'])){
            return ' title="'.trim(isset($link['title']) && !empty(trim($link['title'])) ? $link['title'] : $link['label']).'"';
        }
        return false;
    }
116654
protected function hasVersionedQuery($link)
    {
        // Find querystrings
        $parts = explode('?', $link, 2);
        if (count($parts) < 2) {
            return false;
        }

        // Parse args
        $readingMode = ReadingMode::fromQueryString($parts[1]);
        return !empty($readingMode);
    }
995032
public function getFileInfo($link)
    {
        // get the media link from the resource
        $resource = $this->getResource(\tao_helpers_Uri::decode($link));
        if (!$resource->exists()) {
            throw new \tao_models_classes_FileNotFoundException($link);
        }

        $fileLink = $resource->getUniquePropertyValue($this->getProperty(MediaService::PROPERTY_LINK));
        $fileLink = $fileLink instanceof \core_kernel_classes_Resource ? $fileLink->getUri() : (string)$fileLink;
        $file = null;
        $mime = (string) $resource->getUniquePropertyValue($this->getProperty(MediaService::PROPERTY_MIME_TYPE));

        // add the alt text to file array
        $altArray = $resource->getPropertyValues($this->getProperty(MediaService::PROPERTY_ALT_TEXT));
        $alt = $resource->getLabel();
        if (count($altArray) > 0) {
            $alt = $altArray[0];
        }

        $file = array(
            'name' => $resource->getLabel(),
            'uri' => self::SCHEME_NAME . \tao_helpers_Uri::encode($link),
            'mime' => $mime,
            'size' => $this->getFileManagement()->getFileSize($fileLink),
            'alt' => $alt,
            'link' => $fileLink
        );

        return $file;
    }
674980
private static function getLinks(string $file): array
    {
        $links    = [];
        $contents = (string)file_get_contents($file);
        if (false !== preg_match_all(
            '/\[(.+?)\].*?\((.+?)\)/',
            $contents,
            $matches,
            PREG_SET_ORDER
        )) {
            $links = array_merge($links, $matches);
        }

        return $links;
    }
157913
public static function getAnchorName($link) {
    preg_match_all("/#(.+)$/", $link, $matches);
    if (sizeof($matches) > 0 && sizeof($matches[1]) > 0) {
      $name = $matches[1][0];
      return $name;
    }
    return null;
  }
522516
private function isLinkDecorable($link)
    {
        if (!is_object($link) || !property_exists($link, 'type')) {
            return false;
        }

        return $link->type == 'notes' || $link->type == 'exceptions';
    }
590078
public function download($link)
    {
        $url = str_replace('\/', '/', $link);
        $fileName = \tao_helpers_File::createTempDir() . basename($link);

        common_Logger::d('Downloading ' . $url);
        helpers_TimeOutHelper::setTimeOutLimit(helpers_TimeOutHelper::NO_TIMEOUT);
        $fp = fopen($fileName, 'w+');
        $curlHandler = curl_init();
        curl_setopt($curlHandler, CURLOPT_URL, $url);
        curl_setopt($curlHandler, CURLOPT_FILE, $fp);
        curl_setopt($curlHandler, CURLOPT_TIMEOUT, 50);
        curl_setopt($curlHandler, CURLOPT_FOLLOWLOCATION, true);

        //if there is an http auth on the local domain, it's mandatory to auth with curl
        if (USE_HTTP_AUTH) {

            $addAuth = false;
            $domains = array('localhost', '127.0.0.1', ROOT_URL);

            foreach ($domains as $domain) {
                if (preg_match("/" . preg_quote($domain, '/') . "/", $url)) {
                    $addAuth = true;
                }
            }

            if ($addAuth) {
                curl_setopt($curlHandler, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                curl_setopt($curlHandler, CURLOPT_USERPWD, USE_HTTP_USER . ":" . USE_HTTP_PASS);
            }
        }

        curl_exec($curlHandler);
        $httpCode = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
        $success = $httpCode == 200;
        curl_close($curlHandler);
        fclose($fp);
        helpers_TimeOutHelper::reset();

        return $fileName;
    }
41697
private function getLinks(): array {
        $goodLinks = [];

        $parentNode = $this->article()->getTopNode()->parent();

        if ($parentNode instanceof Element) {
            $candidates = $parentNode->find('a[href]');

            foreach ($candidates as $el) {
                if ($el->attr('href') != '#' && trim($el->attr('href')) != '') {
                    $goodLinks[] = [
                        'url' => $el->attr('href'),
                        'text' => Helper::textNormalise($el->text()),
                    ];
                }
            }
        }

        return $goodLinks;
    }
701022
protected function getContentEditLink($link, $title) {
    $node = $this->getCore()->loadNodeByName($title);

    /** @var \Behat\Mink\Element\DocumentElement $element */
    $element = $this->getSession()->getPage();

    $locator = ($link ? array('link', sprintf("'%s'", $link)) : array('link', "."));

    /** @var \Behat\Mink\Element\NodeElement[] $links */
    $links = $element->findAll('named', $locator);

    // Loop over all the links on the page and check for the node edit path.
    foreach ($links as $result) {
      $target = $result->getAttribute('href');
      if (strpos($target, 'node/' . $this->getCore()->getNodeId($node) . '/edit') !== FALSE) {
        return $result;
      }
    }
    return NULL;
  }
441839
public function delete($link)
    {
        return $this->getMediaService()->deleteResource($this->getResource(\tao_helpers_Uri::decode($link)));
    }
430965
public function isolateVimeoVideoCode($link)
    {
        try {
            if (preg_match("/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/", $link, $output_array)) {
                return $output_array[5];
            }
        } catch (\Exception $e) {
            throw new VideoException("can't match vimeo code in given url", $e);
        }
    }