Returns a location object, used to identify the place in
the source that created a given parsed object.

@param Token $start
@return Location|null
516390
protected function createLocation(Token $start): ?Location
    {
        return !$this->lexer->getOption('noLocation', false)
            ? new Location(
                $start->getStart(),
                $this->lexer->getLastToken()->getEnd(),
                $this->lexer->getSource()
            )
            : null;
    }
1162260
private function getCustomerFromToken()
    {
        if (!($this->tokenStorage instanceof TokenStorageInterface)) {
            return null;
        }

        $token = $this->tokenStorage->getToken();
        if (!($token instanceof TokenInterface)) {
            return null;
        }

        $customer = $token->getUser();
        if (!($customer instanceof CustomerInterface)) {
            return null;
        }

        return $customer;
    }
563281
protected function getContent(array $tokens, int $start, int $end): string
    {
        $content = '';
        for ($i = $start; $i <= $end; $i++) {
            $content .= $tokens[$i]['content'];
        }

        return $content;
    }
791283
public function fetchToken(string $token) : ?Token
    {
        return $this->getModel()
                    ->newQuery()
                    ->where('token', $token)
                    ->first();
    }
1239324
protected function getClosingBracketPosition($contents, $start_pos) {
    $brackets = ['{'];
    for ($pos = $start_pos; $pos < strlen($contents); $pos++) {
      $char = substr($contents, $pos, 1);
      if ($char == '{') {
        array_push($brackets, $char);
      }
      elseif ($char == '}') {
        array_pop($brackets);
      }
      if (count($brackets) == 0) {
        return $pos;
      }
    }

    return NULL;
  }
146057
protected function createLocation(array $ast): ?Location
    {
        return isset($ast['loc']['start'], $ast['loc']['end'])
            ? new Location($ast['loc']['start'], $ast['loc']['end'], $ast['loc']['source'] ?? null)
            : null;
    }
421953
public function peekTokenAt($position) {
		if ($position < count($this->tokens)) {
			return $this->tokens[$position];
		} else {
			return null;
		}
	}
892039
public function getLocation()
    {
        if ($this->file !== null) {
            $path = $this->file->getAbsolutePath();
        } else {
            $path = $this->reader->getResource();
        }
        $this->location = new Location(
            $path,
            xml_get_current_line_number($this->parser),
            xml_get_current_column_number(
                $this->parser
            )
        );

        return $this->location;
    }
420187
public function start($start = null, $autoseek = true)
    {
        if (!func_num_args()) {
            return $this->_start;
        }
        $this->_start = (int) $start;

        if ($autoseek) {
            $this->rewind();
        }
        return $this;
    }
756245
public static function findByEmailToken($token)
    {
        if (!static::isEmailTokenValid($token)) {
            return null;
        }
        return static::find()->where(['email_token' => $token, 'status' => self::STATUS_ACTIVE])->limit(1)->one();
    }
689672
public function getAdverts($start, $end, $section=null)
    {
    
        if($count == 0){
            $count2 = 0;

            $qb2 = $this->getQueryBuilder() 
            ->join('a.located', 'l')
            ->where('l.name = :section')
            ->andWhere('a.from <= :start')
            ->andWhere('a.to >= :end')
            ->andWhere('a.active = :active')
            ->setParameters(array(
                'section' => $section, 
                'start' => $start, 
                'end' => $end,
                'active' => true,
                ));

            $query = $qb2->getQuery();
        }
        
        //->orderBy('s.day', 'ASC')
        $adverts = array();
        if(is_object($query)){
            $adverts = $query->getResult();
        }
        
        $arr = new \Doctrine\Common\Collections\ArrayCollection();
        foreach ($adverts as $ad) {
            $arr->add($ad);
        }
        
        return $arr;
    }
728460
public function getHandler( Location $location )
    {
        foreach ( $this->providers as $providersPriority )
        {
            foreach ( $providersPriority as $provider )
            {
                $currentHandler = $provider->getHandler( $location );

                if ( !$currentHandler instanceof NullHandler )
                {
                    return $currentHandler;
                }
            }
        }

        return new NullHandler();
    }
362261
public function getSource($element = null, $start = null, $end = false, $includeComment = true) {
        $source = false;
        /* @var \ReflectionClass|\ReflectionFunctionAbstract|\ReflectionProperty $element */
        if ($element === null) $element =& $this;
        if ($element instanceof \ReflectionClass || $element instanceof \ReflectionFunctionAbstract) {
            if (is_readable($element->getFileName())) {
                try {
                    $sourceArray = $this->getSourceArray($element, $start, $end);
                    if ($includeComment) {
                        $comment = $element->getDocComment();
                        if (!empty($comment)) {
                            array_unshift($sourceArray, ($element instanceof \ReflectionClass ? '' : '    ') . "{$comment}\n");
                        }
                    }
                    $source = implode('', $sourceArray);
                } catch (\Exception $e) {
                    throw new \xPDO\xPDOException("Error getting source from Reflection element: {$e->getMessage()}");
                }
            }
        } elseif ($element instanceof \ReflectionProperty) {
            $source = '    ';
            if ($includeComment) {
                $comment = $element->getDocComment();
                if (!empty($comment)) {
                    $source = "\n    {$comment}\n    ";
                }
            }
            if ($element->isPublic()) {
                $source .= 'public ';
            } elseif ($element->isProtected()) {
                $source .= 'protected ';
            } elseif ($element->isPrivate()) {
                $source .= 'private ';
            }
            if ($element->isStatic()) {
                $source .= 'static ';
            }
            $source .= '$' . $element->getName();
            if (array_key_exists($element->getName(), $this->defaultProperties) && !is_null($this->defaultProperties[$element->getName()])) {
                $source .= ' = ' . xPDOGenerator::varExport($this->defaultProperties[$element->getName()], 1);
            }
            $source .= ';';
        }
        return $source;
    }
701229
function getAccessTokenFromLocation(location) {
  if (!(location && location.hash.length)) {
    return null;
  }
  // dropbox token usually start with # therefore we want to remore the '#'
  const query = window.location.hash.substring(1);

  return parseQueryString(query).access_token;
}
916178
public function get($key)
    {
        return is_array($value = $this->store()->get($key)) ? new Location($value) : null;
    }
383656
protected function _get($token = null)
    {
        $token = $this->_token($token);
        $entity = $this->_verify($token);

        if ($this->_save($entity)) {
            return $this->_success();
        }

        $this->_error();
    }
553764
protected function getStartRowNumber($start)
    {
        if( $this->start !== NULL )
        {
            $start = (int) $this->start;
        }

        if( empty($start) && ! is_numeric($start) )
        {
            return ! is_numeric($segment = URI::segment(-1)) ? 0 : $segment;
        }
        
        return ! is_numeric($start) ? 0 : $start;
    }