Translate a string via the translator.

@param string      $path    The path within the translation where the string can be found.
@param string|null $section The section from which the translation shall be retrieved.

@return string
517692
protected function translate($path, $section = null)
    {
        return $this->getEnvironment()->getTranslator()->translate($path, $section);
    }
923580
public function findSection($section)
    {
        if (!isset($this->sectionMap[$section])) {
            throw new UnknownSection($section);
        }

        return $this->sectionMap[$section];
    }
310429
public static function shift(&$path)
    {
        $parts = explode('/', trim($path, '/'), 2);
        $result = array_shift($parts);
        $path = array_shift($parts);

        return $result ?: null;
    }
1164015
public function getData($path = null)
    {
        return is_null($path) ? $this->dataDocument : $this->dataDocument->getNodeContent($path);
    }
624677
public static function convertPathForDisplay($path)
    {
        $pathForDisplay = preg_replace('/-\d+' . self::PATH_SEPARATOR . '/', ' / ', $path);

        if ($pathForDisplay !== null && strlen($pathForDisplay) > 0) {
            $pathForDisplay = substr_replace($pathForDisplay, "", -3);
        }

        return $pathForDisplay;
    }
82703
public static function section($path, $start = 0, $end = 0, $undent = false)
	{
		$format = self::getExtension($path);
		$text   = file_get_contents($path);
		if ($start !== 0 || $end !== 0)
		{
			$text = self::lines($text, $start, $end);
			if ($undent)
			{
				$text = self::undent($text);
			}
		}
		return self::output($text, $format);
	}
341035
protected function toString(?string $scheme, string $path): string
    {
        if ($scheme) {
            return $scheme . '://' . $path;
        }

        return $path;
    }
1261962
public function prependLanguage($path, $language = null)
    {
        $prepend = ( isset($language) ? $language : $this->getLanguage() );

        if ( strlen($prepend) > 1 ) {
            return $prepend . (strpos($path, '/') === 0 ? $path : '/' . $path);
        }

        return $path;
    }
377266
protected function scandirCE($path) {
		return (!$this->encoding)? $this->_scandir($path) : $this->convEncOut($this->_scandir($this->convEncIn($path)));
	}
666484
public function section($section, $position = null)
    {
        if (is_string($section)) {
            $section = new FormSection($section);
        }

        return null !== $position ? $this->insert($section, $position) : $this->push($section);
    }
1359393
public function get( $key, $section = NULL )
	{
		if( !is_null( $this->sections ) && $this->sections->has( $section ) )
			return $this->sections->get( $section )->get( $key );
		if( !is_null( $this->pairs ) )
			return $this->pairs->get( $key );
		return NULL;
	}
954923
public function findSectionsForPosition(Section $section)
    {
        $queryBuilder = $this->createQueryBuilder('section');
        $queryBuilder
            ->join('section.activeContribution', 'contribution')
            ->join('section.parent', 'parent')
            ->select('section.id, contribution.title, parent.id as parentId')
            ->andWhere('section.root = :rootId')
            ->andWhere(
                $queryBuilder->expr()->gt('section.level', 0)
            )
            ->andWhere($queryBuilder->expr()->not(
                $queryBuilder->expr()->andX(
                    $queryBuilder->expr()->gt('section.left', $section->getLeft()),
                    $queryBuilder->expr()->lt('section.right', $section->getRight())
                    )
                )
            )
            ->andWhere(
                $queryBuilder->expr()->orX(
                    'section.deleted = :deleted',
                    $queryBuilder->expr()->isNull('section.deleted')
                )
            )
            ->orderBy('section.root, section.left', 'ASC')
            ->setParameter('rootId', $section->getRoot())
            ->setParameter('deleted', false);

        return $queryBuilder->getQuery()->getArrayResult();
    }
605899
protected function scanTo($path, $scope)
    {
        if (!($sub = array_shift($path)) || !isset($scope[$sub])) {
            return null;
        }

        if (!$path) {
            return $scope[$sub];
        }

        return $this->scanTo($path, $scope[$sub]);
    }
360308
public function read($path = null)
    {
        if ($this->isExpanded === false) {
            $this->value = $this->_expand($this->value);
        }

        if ($path === null) {
            return $this->value;
        }

        return Hash::get($this->value, $path);
    }
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;
   }
87538
static public function urlToPath($path)
    {
        $path = parse_url($path);
        return $path === null ? null : str_replace('/', DIRECTORY_SEPARATOR, $path['path']);
    }
332663
public function getParser(string $section, bool $throwException = false)
    {
        if (!self::$parsers) {
            self::$parsers = self::loadDefaultParsers();
        }

        if (isset(self::$parsers[$section])) {
            return self::$parsers[$section];
        }

        if ($throwException) {
            throw new \RuntimeException("The section($section) formatter is not registered!", -500);
        }

        return null;
    }