Método que extrae el pathname para un dominio
@param string $path
@param $domains

@return mixed
168213
private static function extractPathname($path, $domains)
    {
        $filenamePath = $path;
        if (!empty($domains) && !file_exists($path)) {
            foreach ($domains as $domain => $paths) {
                $domainFilename = str_replace($domain, $paths['public'], $path);
                if (file_exists($domainFilename)) {
                    $filenamePath = $domainFilename;
                    continue;
                }
            }

        }

        return $filenamePath;
    }
157193
public function findForLocalesAndDomains(array $locales, array $domains)
    {
        $builder = $this->createQueryBuilder();

        if (count($locales) > 0) {
            $builder->field('locale')->in($locales);
        }

        if (count($domains) > 0) {
            $builder->field('domain')->in($domains);
        }

        $cursor = $builder->getQuery()->execute();

        $files = array();
        foreach ($cursor as $result) {
            $files[] = $result;
        }

        return $files;
    }
400900
public function _buildUrl($path = "", $queryStrings = [], $domain = "")
    {
        $queryString = "";
        foreach ($queryStrings as $key => $value) {
            if (is_array($value)) {
                continue;
            }

            $queryString .= "&{$key}={$value}";
        }
        if (strlen($queryString) > 0) {
            $queryString = "?" . substr($queryString, 1);
        }

        if ($domain == "") {
            $domain = $this->options['base_uri'];
        }

        $path = "/" . trim($path, "/") . "/";

        return "{$domain}{$this->domain}/{$this->options['version']}{$path}{$queryString}";
    }
1095721
private static function get_top_level_domains_from_file( $path ) {
		$domains = [];

		if ( \file_exists( $path ) ) {
			$file = new \SplFileObject( $path );

			while ( ! $file->eof() ) {
				$line = $file->fgets();

				if ( \preg_match( '#^[a-zA-Z0-9][a-zA-Z0-9-]*$#', $line, $matches ) ) {
					$domains[] = \strtolower( $matches[0] );
				}
			}
		}

		if ( \count( $domains ) > 0 ) {
			return \implode( '|', $domains );
		} else {
			return 'ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw';
		}
	}
135937
private function buildPath($domain, $locale)
    {
        $path = '/resources/translations/' . $locale . '/' . $domain . '.' . $locale . '.yml';

        // If long locale dir doesn't exists try short locale and return it if that exists
        if (strlen($locale) == 5 && !is_dir($this->app['path_resolver']->resolve('%root%/app' . $path))) {
            $paths = $this->buildPath($domain, substr($locale, 0, 2));

            if (is_dir($paths[0])) {
                return $paths;
            }
        }

        return [
            $this->app['path_resolver']->resolve('%root%/app' . $path),
            'app' . $path,
        ];
    }
320523
public function resolveFullPath($path)
    {
        if (is_array($path)) {
            $paths  = array();
            foreach ($path as $p) {
                $paths[]    = $this->resolveFullPath($p);
            }
            return $paths;
        } else {
            if (strpos($path, $this->getRepositoryPath()) === 0) {
                return $path;
            }
            $path  = FileSystem::normalizeDirectorySeparator($path);
            $path  = ltrim($path, '/');
            return $this->getRepositoryPath().'/'.$path;
        }
    }
1237550
public static function cygpath($path)
    {
        $path = parent::normalizePath($path, '/');
        $path = preg_replace('|^([a-z]):/|i', '/cygdrive/$1/', $path, 1);
        return $path;
    }
971238
public function path($path)
    {
        $path  = strtolower(trim($path));
        $first = substr($path, 0, 1);
        
        if ($first == '@' && isset($this->aliases[$path])) {
            $path = $this->aliases[$path];
            
        } elseif ($first == '/') {
            $path = preg_replace('/\\//', $this->root() . '/', $path, 1);
            
        }
        if ($path = realpath($path)) {
            $path = static::clean($path);
        }
        
        return $path;
    }
664554
protected function path($path)
    {
        if (strpos($path, './') === 0) {
            return $this->dir . '/' . substr($path, 2);
        }

        if (strpos($path, '../') === 0) {
            return dirname($this->dir) . '/' . substr($path, 3);
        }

        return $path;
    }
285566
private function getRelativePath(string $domain, string $locale): string
    {
        return strtr($this->relativePathTemplate, [
            '%domain%' => $domain,
            '%locale%' => $locale,
            '%extension%' => $this->getExtension(),
        ]);
    }
226593
final protected function generateUrl($domain_key, $path = '/')
    {
        $base_domain = self::$URL_MAP[$domain_key];
        $base_domain = str_replace('{domain}', $this->domain, $base_domain);

        if ($path[0] === '/') {
            $path = substr($path, 1);
        }

        return $base_domain.$path;
    }
1076123
public function removeMatchingCookies($name = null, $domain = null, $path = null)
    {
        $match = function ($cookie) use ($name, $domain, $path) {
            $match = true;

            if (isset($name)) {
                $match = $match && ($cookie->getName() === $name);
            }

            if (isset($domain)) {
                $match = $match && $cookie->matchDomain($domain);
            }

            if (isset($path)) {
                $match = $match && $cookie->matchPath($path);
            }

            return $match;
        };

        $cookies = $this->findMatchingCookies($match);

        $this->removeCookies($cookies);
    }
207064
private function cleanPath($path)
	{
		$path = str_replace('/', $this->DS, $path);
		$path = str_replace('\\', $this->DS, $path);
		$path = preg_replace('#' . $this->DS . '+#', $this->DS, $path);

		return $path;
	}
944904
public function Delete($name, $path = '/', $domain = false, $remove_from_global = true)
    {

        $retval = false;
        if (!headers_sent()) {
            if ($domain === false)
                $domain = $_SERVER['HTTP_HOST'];
            $retval = setcookie($name, '', time() - 3600, $path, $domain);

            if ($remove_from_global)
                unset($_COOKIE[$name]);
        }
        return $retval;
    }
155918
public function delete($key, $path = '/', $domain = null)
    {
        if ($domain === null) {
            $domain = $this->domain;
        }
        $key = $this->prefix . $key;
        if (!is_cli()) {
            setcookie($key, null, -2628000, $path, $domain);
        }
        unset($_COOKIE[$key]);
    }
598861
protected function getCatalogPath($locale, $domain) {
		if ($this->basePath === null) {
			throw new NoPath('Base path definition required');
		}
		
		// Path to the file resolve
		$pathParts = [$this->basePath];
		
		foreach ($this->pathTemplate as $part) {
			if ($part === self::TPL_LOCALE) {
				$pathParts[] = $locale;
				continue;
			}
			
			if ($part === self::TPL_DOMAIN) {
				$pathParts[] = $domain;
			}
		}
		
		// Filename resolve
		$flenameParts = [];
		
		foreach ($this->filenameTemplate as $part) {
			if ($part === self::TPL_LOCALE) {
				$flenameParts[] = $locale;
				continue;
			}
			
			if ($part === self::TPL_DOMAIN) {
				$flenameParts[] = $domain;
			}
		}
		
		$filename = implode($this->filenameSeparator, $flenameParts);
		
		// Extension resolve
		if ($this->filenameExtension !== null) {
			$filename .= '.' . $this->filenameExtension;
		}
		
		$pathParts[] = $filename;
		
		return implode(DIRECTORY_SEPARATOR, $pathParts);
	}
760816
protected function makeSurePathIsAbsolute($path): string
    {
        $site_url = rtrim($this->getParameter('site_url'), '/') . '/';

        if (0 !== strpos($path, 'http')) {
            return $site_url . ltrim($path, '/');
        } else {
            return $path;
        }
    }