returns the active class if the defined segment exists
in the current request URI

@param		string|array 	$slugs
@param		int|array			$segments
@param		string|NULL		$active
@return	string
545450
public function hasSegment($slugs, $segments = 1, $active = NULL)
  {
		$this->setActive($active);
    $segments = (!is_array($segments) ? [$segments] : $segments);
    $slugs = (!is_array($slugs) ? [$slugs] : $slugs);
		foreach ($slugs as $slug) {
      foreach ($segments as $segment) {
        if ($this->request->segment($segment) == $slug) return $this->active;
      }
		}
	  return '';
  }
855181
public static function url($segments, $options = array())
    {
        $request = Router::getInstance()->request;

        $options['X-App-Id'] = Context::getKey()->app_id;
        $options['X-App-Key'] = Context::getKey()->key;

        $segments .= '?' . http_build_query($options);

        return $request->getUrl() . $request->getScriptName() . '/' . $segments;
    }
295112
private function getDynamicRouteIds(array $segments): array
    {
        $matched = [];
        $index = 0;

        do {
            $matched[] =
                $this->provider->getRoutesBySegmentValue($index, $segments[$index]) +
                $this->provider->getRoutesBySegmentValue($index, RouteDefinition::DYNAMIC_SEGMENT);
            $index++;
        } while (isset($segments[$index]));

        $matched[] = $this->provider->getRoutesBySegmentCount(\count($segments));

        return array_values(array_intersect_key(... $matched));
    }
81558
public static function get( $slug ) {
		return isset( self::$queues[ $slug ] ) ? self::$queues[ $slug ] : null;
	}
484956
public static function getLanguages($active = true, $asArray = false)
    {
        if ($active) {
            return self::find()->where(['status' => static::STATUS_ACTIVE])->asArray($asArray)->all();
        } else {
            return self::find()->asArray($asArray)->all();
        }
    }
870292
public function findFrontCategories(array $slugs)
    {
        $qb = $this->createQueryBuilder('category')
            ->where('category.enabled = :enabled')
            ->setParameter('enabled', true)
            ->andWhere('category.slug IN ( :slugs )')
            ->setParameter('slugs', $slugs)
        ;

        /** @var Category[] $results */
        $results = $qb
            ->getQuery()
            ->useResultCache($this->cacheEnabled, $this->cacheTtl)
            ->getResult()
        ;

        $resultsSortedBySlug = [];

        foreach ($results as $category) {
            $resultsSortedBySlug[$category->getSlug()] = $category;
        }

        return $resultsSortedBySlug;
    }
1104464
public function getNodeForSlug(Node $parentNode, $slug)
    {
        $slugParts = explode('/', $slug);
        $result = null;
        foreach ($slugParts as $slugPart) {
            if ($parentNode) {
                if ($r = $this->findOneBy(
                    array(
                        'slug' => $slugPart,
                        'parent.parent' => $parentNode->getId(),
                    )
                )
                ) {
                    $result = $r;
                }
            } else {
                if ($r = $this->findOneBy(array('slug' => $slugPart))) {
                    $result = $r;
                }
            }
        }

        return $result;
    }
782962
private function uriConstruct($slug, $params) {
		$uri = self::API_HOST . '/' . $slug;
		if ($params) {
			$queryData = http_build_query($params);
			$uri .= '?' . $queryData;
		}

		return $uri;
	}
608476
public function breadcrumb(String $uri = NULL, Int $segmentCount = -1) 
    {
        $uris = $this->getURIsegments($uri, $segmentCount);
        $list = $this->breadcrumbOlList($uris);

        return $this->breadcrumbNav($list);
    }
182813
public function getRequestSegments()
    {
        if (empty($this->requestSegments)) {
            $segments[] = $this->getParameter();

            if ( ! in_array($this->getRequestMethod(), ['index', 'route'])) {
                array_push($segments, $this->getRequestMethod());
            }

            $this->setRequestSegments($segments);
        }

        return $this->requestSegments;
    }
477382
public function getContentsBySlugsFunction($slugs, $keepOrder = false)
    {
        $search = $this->repository->createSearch();
        $search->addQuery(new TermsQuery('slug', $slugs), 'should');

        $result = $this->repository->execute($search);

        if ($keepOrder) {
            $orderedResult = [];
            foreach ($slugs as $slug) {
                foreach ($result as $document) {
                    if ($document->slug == $slug) {
                        $orderedResult[] = $document;
                    }
                }
            }

            $result = $orderedResult;
        }

        return $result;
    }
704124
protected function getTarget($target, array $segments)
    {
        foreach ($segments as $segment) {
            if (!$target) {
                return;
            }

            $target = $target->{$segment};
        }

        return $target;
    }
1151884
public static function join(...$segments)
    {
        $path = array();
        foreach ($segments as $segment) {
            $path = array_merge($path, (array) $segment);
        }

        $path = array_map(function ($segment) {
            return trim($segment, DIRECTORY_SEPARATOR);
        }, $path);

        $path = array_filter($path);

        $path = implode(DIRECTORY_SEPARATOR, $path);

        // First segment slash.
        if ((is_array($segments[0]) && strpos($segments[0][0], DIRECTORY_SEPARATOR) === 0)
            || strpos($segments[0], DIRECTORY_SEPARATOR) === 0
        ) {
            return DIRECTORY_SEPARATOR . $path;
        }
        return $path;
    }
1148229
public function getRoute($slug = '', $absolute = FALSE, array $params = [])
    {
        if ('' === $slug) {
            return $absolute ? Request::getInstance()->getRootUrl() . '/' : '/';
        }
        if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) {
            throw new RouterException(t('No existe la ruta especificada'));
        }
        $url = $absolute ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
        if (!empty($params)) {
            foreach ($params as $key => $value) {
                $url = str_replace('{' . $key . '}', $value, $url);
            }
        } elseif (!empty($this->routing[$this->slugs[$slug]]['default'])) {
            $url = $absolute ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]['default'] : $this->routing[$this->slugs[$slug]]['default'];
        }

        return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url);
    }
1217619
public function getLocaleFromRoute($segments = null) {
        // if segmets are not set - get from current request
        if (is_null($segments)) {
            $segments = \Request::segments();
        }
        $locale = $this->getDefaultRoutelocale();
        if ($allLocales = \Routelocale::getAllRoutelocales()) {
            // reduce array of segments to [0] and find by value
            if ($curLocaleIndex = array_search(array_shift($segments), $allLocales)) {
                $locale = $allLocales[$curLocaleIndex];
            }  
        }
        return $locale;
    }
863600
public function findOneBySlug($slug)
    {
        // select
        $qb = $this->getQueryBuilder()
            ->select('p.id, t.title, t.description, t.metaTitle, t.metaDescription, t.metaTags, p.active');

        //join
        $qb->leftJoin('p.translations', 't');
        
        $qb->where('t.slug LIKE :slug')
           ->andWhere('p.active LIKE :active')
            ->setParameter('slug', '%'.$slug.'%')
            ->setParameter('active', true);

        return $qb->getQuery()->getSingleResult();
    }
776251
public function checkQuery($fullUrlWithQuery,$active=null,$inactive=null)
    {
        $this->setReturnValue($active,$inactive);

        if (is_array($fullUrlWithQuery)) {
            $result = call_user_func_array(array($this,'queryIsDeeply'), $fullUrlWithQuery);
        } else {
            $result = $this->queryIsDeeply($fullUrlWithQuery);   
        }

        return $result ? $this->activeValue : $this->inActiveValue;
    }