Returns a category, given an ID (which is a URL).

@internal
@param string $url The category URL.
175615
public function get_category($url) {
        // Curl the json for this category.
        $raw = $this->curl("{$url}.json");

        $baseurl = strpos($url, API::MEDWAY_URL) !== false ? API::MEDWAY_URL : API::CANTERBURY_URL;
        $parser = new Parser($this, $baseurl, $raw);
        if (!$parser->is_valid()) {
            return array();
        }

        return $parser->get_category($url);
    }
204365
def blog__get_category(id: nil, permalink: nil)
      return {} unless id || permalink

      if id
        category = LatoBlog::Category.find_by(id: id.to_i)
      else
        category = LatoBlog::Category.find_by(meta_permalink: permalink)
      end

      category.serialize
    end
450829
public function show($id)
    {
        try {
            $category = $this->repository->findById($id);

            return $this->view('categories.show', compact('category'));
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
227557
def category(self, category):
        
        self.url.category = category
        self.url.set_page(1)
        return self
873548
public function parseURL($url)
	{
		try {
			$u = parse_url($url);
			if(isset($u["query"]))
	        	$this->parseQueryString($u["query"]);
	        if(isset($u["fragment"]))
	        	$this->parseQueryString($u["fragment"]);
	    } catch (Exception $e) {
	    } 
	}
1347160
public function get ($id)
		{
			foreach ($this->_data as $category)
				if ($category->id == $id)
					return $category;

			return null;
		}
471699
public function fetch( $url ) {
		try {
			$new_h5p_id = \H5P_Plugin::get_instance()->fetch_h5p( $url );
		} catch ( \Throwable $e ) {
			$new_h5p_id = 0;
		}
		return $new_h5p_id;
	}
928028
public function get_item($url) {
        $raw = $this->curl($url . '.json');
        $json = json_decode($raw, true);
        if (!$json) {
            return null;
        }

        return new Item($this, $url, $json);
    }
80070
public function url($url = null)
    {
        if ($url === null) {
            return $this->_url;
        }
        $this->_url = $url;

        return $this;
    }
480313
public static function get( $url )
	{
		$checksum	= "6".self::calculateChecksum( self::strord( "info:".$url ) );
		$googleUrl	= "www.google.com/search?client=navclient-auto&ch=".$checksum."&features=Rank&q=info:".$url;
		$curl		= new Net_CURL( $googleUrl );
		$response	= $curl->exec();
		$position	= strpos( $response, "Rank_" );
		if( $position === FALSE )
			throw new Exception( 'Response does not contain Rank.' );
		$pagerank = substr( $response, $position + 9 );
		return (int) $pagerank;
	}
2443
public function category()
    {
        $category   = $this->param('category_id', 0);
        $categoryId = explode(':', $category)[0];

        return Category::query()->findOrNew($categoryId);
    }
323093
public function getCategory($categoryId)
    {

        // try to load the category with the passed ID
        foreach ($this->categories as $category) {
            if ($category[MemberNames::ENTITY_ID] == $categoryId) {
                return $category;
            }
        }

        // throw an exception if the category is NOT available
        throw new \Exception(sprintf('Can\'t load category with ID %d in file %s on line %d', $categoryId));
    }
1266969
public static function getCategoryByHandle($element)
    {
        $categoryGroup = Craft::$app->categories->getGroupByHandle($element['category']);
        if ($categoryGroup) {

            $query = Category::find();
            $query->groupId($categoryGroup->id);
            $query->slug($element['slug']);
            $category = $query->one();

            if ($category) {
                return $category;
            }
        }

        return false;
    }
684582
public static function getInternalPath($url)
    {
        $path = parse_url($url, PHP_URL_PATH);

        return ($path === '/') ? $path : ltrim($path, '/');
    }
1348129
private function parseUrl($url)
    {
        $parsed = parse_url($url);

        if ((count($parsed) === 1)
            && isset($parsed['path'])
            && (0 === strpos($parsed['path'], '?') || false !== strpos($parsed['path'], '&'))
        ) {
            $parsed = array(
                'query' => $parsed['path']
            );

            return $parsed;
        }

        return $parsed;
    }
885419
public static function collectionFromUrl($url)
    {
        $url = Collection::collect(parse_url($url));
        $url->set('query', static::collectionFromUrlQuery($url->get('query')));

        return $url;
    }
1307331
public function getCategories($context = null)
    {
        $context = $this->getContext($context);

        $this->loadCategories($context);

        return $this->categories[$context->getId()];
    }