@param string $stackName
@param string $cvID
\Concrete\Core\Site\Tree\TreeInterface|null $site
@param int $multilingualContentSource

@return self|false|null
173500
public static function getByName($stackName, $cvID = 'RECENT', TreeInterface $site = null, $multilingualContentSource = self::MULTILINGUAL_CONTENT_SOURCE_CURRENT)
    {
        $c = Page::getCurrentPage();
        if (is_object($c) && (!$c->isError())) {
            $identifier = sprintf('/stack/name/%s/%s/%s/%s', $stackName, $c->getCollectionID(), $cvID, $multilingualContentSource);
            $cache = Core::make('cache/request');
            $item = $cache->getItem($identifier);
            if (!$item->isMiss()) {
                $cID = $item->get();
            } else {
                $item->lock();
                $db = Database::connection();
                $ms = false;
                $detector = Core::make('multilingual/detector');
                if ($detector->isEnabled()) {
                    $ms = self::getMultilingualSectionFromType($multilingualContentSource);
                }
                $sql = 'select cID from Stacks where stName = ?';
                $q = [$stackName];
                if ($ms) {
                    $sql .= ' and (stMultilingualSection = ? or stMultilingualSection = 0)';
                    $q[] = $ms->getCollectionID();
                } else {
                    $sql .= ' and stMultilingualSection = 0';
                }
                //$sql .= ' and siteTreeID = ?';
                if ($ms) {
                    $sql .= ' order by stMultilingualSection desc';
                }
                $sql .= ' limit 1';
                /*if (!is_object($site)) {
                    $site = \Core::make('site')->getSite();
                }
                if ($site instanceof Site) {
                    $q[] = $site->getDefaultLocale()->getSiteTree()->getSiteTreeID();
                } else {
                    $q[] = $site->getSiteTreeID();
                }*/
                $cID = $db->fetchColumn($sql, $q);
                $cache->save($item->set($cID));
            }
        } else {
            $db = Database::connection();
            $cID = $db->fetchColumn(
                'select cID from Stacks where stName = ? and stMultilingualSection = 0',
                [$stackName]
            );
        }

        return $cID ? static::getByID($cID, $cvID) : null;
    }
924572
protected function checkLeadingContent(File $phpcsFile, $stackPtr)
    {
        $tokens                   = $phpcsFile->getTokens();
        $leadingContent           = $this->getLeadingContent($phpcsFile, $stackPtr);
        $controlStructureStartPtr = $this->getLeadingCommentOrSelf($phpcsFile, $stackPtr);

        if ($tokens[$leadingContent]['code'] === T_OPEN_TAG) {
            // At the beginning of the script or embedded code.
            return;
        }

        $firstNonWhitespace = $phpcsFile->findPrevious(
            T_WHITESPACE,
            ($controlStructureStartPtr - 1),
            $leadingContent,
            true
        );
        $firstNonWhitespace = $firstNonWhitespace ?: $leadingContent;
        $leadingLineNumber  = $tokens[$firstNonWhitespace]['line'];

        if ($tokens[$leadingContent]['code'] === T_OPEN_CURLY_BRACKET
            || $this->insideSwitchCase($phpcsFile, $leadingContent) === true
            || ($this->elseOrElseIf($phpcsFile, $stackPtr) === true && $this->ifOrElseIf($phpcsFile, $leadingContent) === true)
            || ($this->isCatch($phpcsFile, $stackPtr) === true && $this->isTryOrCatch($phpcsFile, $leadingContent) === true)
        ) {
            if ($this->isFunction($phpcsFile, $leadingContent) === true) {
                // The previous content is the opening brace of a function
                // so normal function rules apply and we can ignore it.
                return;
            }

            if ($this->isClosure($phpcsFile, $stackPtr, $leadingContent) === true) {
                return;
            }

            if ($tokens[$controlStructureStartPtr]['line'] !== ($leadingLineNumber + 1)) {
                $data = array($tokens[$stackPtr]['content']);
                $diff = $tokens[$controlStructureStartPtr]['line'] - ($leadingLineNumber + 1);
                if ($diff < 0) {
                    $error = 'Beginning of the "%s" control structure must be first content on the line';
                    $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'ContentBeforeStart', $data);
                } else {
                    $data[] = $diff;
                    $error  = 'Expected 0 blank lines before "%s" control structure; %s found';
                    $fix    = $phpcsFile->addFixableError($error, $stackPtr, 'LineBeforeOpen', $data);
                }

                if ($fix === true) {
                    $phpcsFile->fixer->beginChangeset();

                    for ($i = ($firstNonWhitespace + 1); $i < $controlStructureStartPtr; $i++) {
                        if ($tokens[$i]['line'] === $tokens[$controlStructureStartPtr]['line']) {
                            // Keep existing indentation.
                            break;
                        }

                        $phpcsFile->fixer->replaceToken($i, '');
                    }

                    $phpcsFile->fixer->addNewline($firstNonWhitespace);
                    $phpcsFile->fixer->endChangeset();
                }
            }//end if
        } elseif ($tokens[$controlStructureStartPtr]['line'] === ($leadingLineNumber + 1)) {
            // Code on the previous line before control structure start.
            $data  = array($tokens[$stackPtr]['content']);
            $error = 'No blank line found before "%s" control structure';
            $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'NoLineBeforeOpen', $data);

            if ($fix === true) {
                $phpcsFile->fixer->beginChangeset();
                $phpcsFile->fixer->addNewline($firstNonWhitespace);
                $phpcsFile->fixer->endChangeset();
            }
        }//end if
    }
767866
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        // We are only interested in the first token in a multi-line string.
        if ($tokens[$stackPtr]['code'] === $tokens[$stackPtr - 1]['code']) {
            return;
        }

        $workingString = $tokens[$stackPtr]['content'];
        for ($i = $stackPtr + 1; $tokens[$i]['code'] === $tokens[$stackPtr]['code']; ++$i) {
            $workingString .= $tokens[$i]['content'];
        }

        // The use of variables in double quoted strings is allowed.
        if ($tokens[$stackPtr]['code'] === T_DOUBLE_QUOTED_STRING) {
            $openBraces = 0;
            foreach (token_get_all("<?php {$workingString}") as $token) {
                if (is_array($token) === true) {
                    if ($token[0] == T_CURLY_OPEN) {
                        ++$openBraces;
                    } elseif ($token[0] == T_VARIABLE && $openBraces < 1) {
                        $phpcsFile->addError(
                            "String {$workingString} has a variable embedded without being delimited by braces",
                            $stackPtr,
                            'ContainsNonDelimitedVariable',
                            [$token[1]]
                        );
                    }
                } elseif ($token == '}') {
                    --$openBraces;
                }
            }
        }
    }
460051
function createContentDraft($parentLocationId, $contentTypeIdentifier, $fields, $languageCode = null )
    {
        $languageCode = $languageCode ?: self::DEFAULT_LANGUAGE;

        $repository = $this->getRepository();
        $content = $repository->sudo(
            function() use( $repository, $languageCode, $contentTypeIdentifier, $fields, $parentLocationId )
            {
                $contentService = $repository->getcontentService();
                $contentTypeService = $repository->getContentTypeService();
                $locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( $parentLocationId );

                $contentTypeIdentifier = $contentTypeService->loadContentTypeByIdentifier( $contentTypeIdentifier );
                $contentCreateStruct = $contentService->newContentCreateStruct( $contentTypeIdentifier, $languageCode );
                foreach ( array_keys( $fields ) as $key ) {
                    $contentCreateStruct->setField( $key, $fields[$key] );
                }
                return $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
            }
        );

        $this->addObjectToList( $content );

        return $content;
    }
440155
public function process(File $phpcsFile, $stackPointer)
    {
        $tokens = $phpcsFile->getTokens();

        $memberCandidate    = $tokens[$stackPointer + 2];
        $semicolonCandidate = $tokens[$stackPointer + 3];
        $equalsCandidate    = $tokens[$stackPointer + 4];
        $valueCandidate     = $tokens[$stackPointer + 6];

        $isMemberVariable            = $memberCandidate['type'] === 'T_VARIABLE';
        $memberVariableWithSemicolon = $semicolonCandidate['type'] === 'T_SEMICOLON';
        $memberVariableWithEquals    = $equalsCandidate['type'] === 'T_EQUALS';
        $isValidValueType            = in_array($valueCandidate['type'], $this->validValueTypes, true);

        if ($isMemberVariable && $memberVariableWithSemicolon && !$memberVariableWithEquals && !$isValidValueType)
        {
            $type  = 'Production.MemberDefaultPresent.MembervariableWithoutDefaultValue';
            $data  = $memberCandidate['content'];
            $error = 'Membervariable ' . $memberCandidate['content'] . ' without default value';
            $phpcsFile->addWarning($error, $stackPointer, $type, $data);
        }
    }
1207381
public function getLocalizedStack(Section $section, $cvID = 'RECENT')
    {
        $result = null;
        $mySectionID = $this->getMultilingualSectionID();
        if ($mySectionID !== 0 && $section->getCollectionID() == $mySectionID) {
            $result = $this;
        } else {
            $neutralID = ($mySectionID === 0) ? $this->getCollectionID() : $this->getNeutralStackID();
            $db = Database::connection();
            $localizedID = $db->fetchColumn(
                '
                    select
    	               Stacks.cID
                    from
    	               Stacks
    	               inner join Pages on Stacks.cID = Pages.cID
                    where
    	               Pages.cParentID = ? and Stacks.stMultilingualSection = ?
                    limit 1
                ',
                [$neutralID, $section->getCollectionID()]
            );
            if ($localizedID) {
                $localized = static::getByID($localizedID, $cvID);
                if ($localized) {
                    $result = $localized;
                }
            }
        }

        return $result;
    }
771063
protected function assertNotThisOrStatic(File $phpCsFile, int $stackPointer): void
    {
        $docBlockEndIndex = $this->findRelatedDocBlock($phpCsFile, $stackPointer);

        if (!$docBlockEndIndex) {
            return;
        }

        $tokens = $phpCsFile->getTokens();

        $docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener'];

        for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) {
            if ($tokens[$i]['type'] !== 'T_DOC_COMMENT_TAG') {
                continue;
            }
            if ($tokens[$i]['content'] !== '@return') {
                continue;
            }

            $classNameIndex = $i + 2;

            if ($tokens[$classNameIndex]['type'] !== 'T_DOC_COMMENT_STRING') {
                continue;
            }

            $content = $tokens[$classNameIndex]['content'];
            if (!$content || strpos($content, '\\') !== 0) {
                continue;
            }

            $classNameWithNamespace = $this->getClassNameWithNamespace($phpCsFile);
            if ($content !== $classNameWithNamespace) {
                continue;
            }

            $phpCsFile->addError('Class name repeated, expected `self` or `$this`.', $classNameIndex, 'TypeHint.Invalid.Class');
        }
    }
1146183
public function loadLevel(string $categoryId, SalesChannelContext $context): ?Tree
    {
        /** @var CategoryEntity $active */
        $active = $this->loadActive($categoryId, $context);

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('visible', true));
        $criteria->addFilter(new MultiFilter(
            MultiFilter::CONNECTION_OR,
            [
                new EqualsFilter('category.id', $categoryId),
                new EqualsFilter('category.parentId', $categoryId),
            ]
        ));

        /** @var CategoryCollection $categories */
        $categories = $this->categoryRepository->search($criteria, $context)->getEntities();
        $parentId = $categories->get($categoryId)->getParentId();

        return $this->getTree($parentId, $categories, $active);
    }
1039275
protected function checkUseForReturnTypeHint(File $phpcsFile, int $stackPtr): void
    {
        $tokens = $phpcsFile->getTokens();

        $openParenthesisIndex = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr + 1);
        $closeParenthesisIndex = $tokens[$openParenthesisIndex]['parenthesis_closer'];

        $colonIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $closeParenthesisIndex + 1, null, true);
        if (!$colonIndex) {
            return;
        }

        $startIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $colonIndex + 1, $colonIndex + 3, true);
        if (!$startIndex) {
            return;
        }

        if ($tokens[$startIndex]['type'] === 'T_NULLABLE') {
            $startIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $startIndex + 1, $startIndex + 3, true);
        }

        $lastIndex = null;
        $j = $startIndex;
        $extractedUseStatement = '';
        $lastSeparatorIndex = null;
        while (true) {
            if (!$this->isGivenKind([T_NS_SEPARATOR, T_STRING, T_RETURN_TYPE], $tokens[$j])) {
                break;
            }

            $lastIndex = $j;
            $extractedUseStatement .= $tokens[$j]['content'];
            if ($this->isGivenKind([T_NS_SEPARATOR], $tokens[$j])) {
                $lastSeparatorIndex = $j;
            }
            ++$j;
        }

        if ($lastIndex === null || $lastSeparatorIndex === null) {
            return;
        }

        $extractedUseStatement = ltrim($extractedUseStatement, '\\');
        $className = '';
        for ($k = $lastSeparatorIndex + 1; $k <= $lastIndex; ++$k) {
            $className .= $tokens[$k]['content'];
        }

        $error = 'Use statement ' . $extractedUseStatement . ' for class ' . $className . ' should be in use block.';
        $fix = $phpcsFile->addFixableError($error, $colonIndex, 'ReturnSignature');
        if (!$fix) {
            return;
        }

        $phpcsFile->fixer->beginChangeset();

        $firstSeparatorIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $startIndex, null, true);

        $addedUseStatement = $this->addUseStatement($phpcsFile, $className, $extractedUseStatement);

        for ($k = $lastSeparatorIndex; $k > $firstSeparatorIndex; --$k) {
            $phpcsFile->fixer->replaceToken($k, '');
        }
        $phpcsFile->fixer->replaceToken($firstSeparatorIndex, '');

        if ($addedUseStatement['alias'] !== null) {
            $phpcsFile->fixer->replaceToken($lastIndex, $addedUseStatement['alias']);
        }

        $phpcsFile->fixer->endChangeset();
    }
228223
protected function processVariableInString(File $phpcsFile, $stackPtr)
    {
        $tokens         = $phpcsFile->getTokens();
        $content        = $tokens[$stackPtr]['content'];
        $variablesFound = preg_match_all(
            '|[^\\\]\${?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)|',
            $content,
            $matches,
            PREG_SET_ORDER + PREG_OFFSET_CAPTURE
        );

        if ($variablesFound === 0) {
            return;
        }

        foreach ($matches as $match) {
            $varName = $match[1][0];
            $offset  = $match[1][1];

            // If it's a php reserved var, then its ok.
            if (in_array($varName, $this->phpReservedVars) === true) {
                continue;
            }

            // Don't validate class/object property usage in strings,
            // because their declaration is already validated.
            $variablePrefix = substr($content, $offset - 3, 2);
            if ($variablePrefix === '::' || $variablePrefix === '->') {
                continue;
            }

            if ($this->isSnakeCaps($varName) === false) {
                $error = 'Variable in string "%s" is not in valid snake caps format';
                $data  = array($varName);
                $phpcsFile->addError($error, $stackPtr, 'StringNotSnakeCaps', $data);
            }
        }//end foreach
    }
412945
public function process(File $phpcsFile, $stackPointer)
    {
        $tokens  = $phpcsFile->getTokens();
        $content = $tokens[$stackPointer]['content'];
        if (preg_match('/@ *inject/i', $content) !== 0)
        {
            $injectContent     = $tokens[$stackPointer]['content']
                . $tokens[$stackPointer + 1]['content']
                . $tokens[$stackPointer + 2]['content'];
            $injectMatches     = [];
            $injectPattern     = '@Inject(\(\{"[a-zA-Z]+((\.|\\\\|_)[a-zA-Z]+)*"(, "[a-zA-Z]+((\.|\\\\|_)[a-zA-Z]+)*")*\}\))?';
            $injectablePattern = '@Injectable\([a-zA-Z]+="[a-zA-Z]+"(, ([a-zA-Z]+="[a-zA-Z]+"|[a-zA-Z]+=(true|false)))*\)';
            $completePattern   = '/(' . $injectPattern . ')|(' . $injectablePattern . ')/';
            preg_match($completePattern, $injectContent, $injectMatches);
            if (empty($injectMatches))
            {
                $type  = 'Production.Inject.InjectionFound';
                $data  = [$injectContent];
                $error = 'Inject[able] annotation has wrong format.';
                $phpcsFile->addWarning($error, $stackPointer, $type, $data);
            }
        }
    }
641177
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
	{
		$tokens = $phpcsFile->getTokens();
		
		// Only work on level 1 "use", means including traits
		if ($tokens[$stackPtr]['level' ] != 1) {
			return;
		}

		$nextComma = $phpcsFile->findNext(T_COMMA, $stackPtr);
		$nextSemi = $phpcsFile->findNext(T_SEMICOLON, $stackPtr);

		if ($nextComma !== false && $nextComma < $nextSemi) {
			$error = 'Only one trait should be included per "use"';
			$phpcsFile->addError($error, $stackPtr, 'OnlyOneTraitPerUse');
		}
	}
1265764
public static function dump($var, $maxdepth = 10, $maxValueLen = 255, $stack = [])
    {
        $children = $hierarchyNotation = null;

        if (is_object($var)) {
            $children = get_object_vars($var);
            $hierarchyNotation = '->%s';
        } elseif (is_array($var)) {
            $children = $var;
            $hierarchyNotation = '[%s]';
        }


        if (isset($children)) {
            $ret = self::formatDumpStack($stack, $var);

            if ($maxdepth >= 0 && count($stack) == $maxdepth) {
                $ret .= ' (...)' . "\n";
            } else {
                if (count($children) == 0) {
                    $ret .= "(empty)\n";
                } else {
                    $ret .= "\n";

                    $i = 0;
                    foreach ($children as $name => $value) {
                        array_push($stack, sprintf($hierarchyNotation, $name));
                        $ret .= self::dump($value, $maxdepth, $maxValueLen, $stack);
                        array_pop($stack);
                        $i++;
                    }
                }
            }
        } else {
            $val = self::dumpScalar($var, $maxValueLen);
            if ($stack) {
                $ret = join('', $stack) . ' = ' . $val;
            } else {
                $ret = $val;
            }
            $ret .= "\n";
        }
        return $ret;
    }
869273
private function resolveContent(
        Row $row,
        $locale,
        $locales,
        MappingInterface $mapping,
        UserInterface $user = null
    ) {
        $webspaceKey = $this->nodeHelper->extractWebspaceFromPath($row->getPath());

        $originalLocale = $locale;
        $availableLocales = $this->resolveAvailableLocales($row);
        $ghostLocale = $this->localizationFinder->findAvailableLocale(
            $webspaceKey,
            $availableLocales,
            $locale
        );
        if (null === $ghostLocale) {
            $ghostLocale = reset($availableLocales);
        }

        $type = null;
        if ($row->getValue('shadowOn')) {
            if (!$mapping->shouldHydrateShadow()) {
                return;
            }
            $type = StructureType::getShadow($row->getValue('shadowBase'));
        } elseif (null !== $ghostLocale && $ghostLocale !== $originalLocale) {
            if (!$mapping->shouldHydrateGhost()) {
                return;
            }
            $locale = $ghostLocale;
            $type = StructureType::getGhost($locale);
        }

        if (
            RedirectType::INTERNAL === $row->getValue('nodeType')
            && $mapping->followInternalLink()
            && '' !== $row->getValue('internalLink')
            && $row->getValue('internalLink') !== $row->getValue('uuid')
        ) {
            // TODO collect all internal link contents and query once
            return $this->resolveInternalLinkContent($row, $locale, $webspaceKey, $mapping, $type, $user);
        }

        $shadowBase = null;
        if ($row->getValue('shadowOn')) {
            $shadowBase = $row->getValue('shadowBase');
        }

        $data = [];
        foreach ($mapping->getProperties() as $item) {
            $data[$item] = $this->resolveProperty($row, $item, $locale, $shadowBase);
        }

        $content = new Content(
            $originalLocale,
            $webspaceKey,
            $row->getValue('uuid'),
            $this->resolvePath($row, $webspaceKey),
            $row->getValue('state'),
            $row->getValue('nodeType'),
            $this->resolveHasChildren($row), $this->resolveProperty($row, 'template', $locale, $shadowBase),
            $data,
            $this->resolvePermissions($row, $user),
            $type
        );
        $content->setRow($row);

        if (!$content->getTemplate() || !$this->structureManager->getStructure($content->getTemplate())) {
            $content->setBrokenTemplate();
        }

        if ($mapping->resolveUrl()) {
            $url = $this->resolveUrl($row, $locale);
            $urls = [];
            array_walk(
                $locales,
                function($item) use (&$urls, $row) {
                    $urls[$item] = $this->resolveUrl($row, $item);
                }
            );

            $content->setUrl($url);
            $content->setUrls($urls);
        }

        if ($mapping->resolveConcreteLocales()) {
            $locales = $this->resolveAvailableLocales($row);
            $content->setContentLocales($locales);
        }

        return $content;
    }
198345
public function getStack($stackName, $organization = '')
    {
        $contents = $this
            ->call('GET', implode('/', [self::STACK_RESOURCE, $this->getOrganizationName($organization), $stackName]))
            ->getBody()
            ->getContents();

        return Stack::createFromJsonResponse($contents);
    }
591635
protected function processMemberVar( PHP_CodeSniffer_File $phpcsFile,
        $stackPtr )
    {
        $tokens = $phpcsFile->getTokens();
        $varName = ltrim( $tokens[ $stackPtr ][ 'content' ], '$' );
        $memberProps = $phpcsFile->getMemberProperties( $stackPtr );
        $public = ($memberProps[ 'scope' ] === 'public');
		$protected = ($memberProps['scope'] === 'protected');
		
        if ( $public === true )
        {
            if ( substr( $varName, 0, 1 ) === '_' )
            {
                $error = 'Public member variable "%s" must not contain a leading underscore';
                $data = array( $varName );
                $phpcsFile->addError( $error, $stackPtr, 'PublicHasUnderscore',
                    $data );
                return;
            }
        }
		else if ($protected === true)
		{
			if ( substr( $varName, 0, 1 ) === '_' )
            {
                $error = 'Protected member variable "%s" must not contain a leading underscore';
                $data = array( $varName );
                $phpcsFile->addError( $error, $stackPtr, 'ProtectedHasUnderscore',
                    $data );
                return;
            }
		}
        else
        {
            if ( substr( $varName, 0, 1 ) !== '_' )
            {
                $scope = ucfirst( $memberProps[ 'scope' ] );
                $error = '%s member variable "%s" must contain a leading underscore';
                $data = array(
                    $scope,
                    $varName,
                );
                $phpcsFile->addError( $error, $stackPtr, 'PrivateNoUnderscore',
                    $data );
                return;
            }
        }

        if ( PHP_CodeSniffer::isCamelCaps( $varName, false, $public || $protected, false ) === false )
        {
            $error = 'Variable "%s" is not in valid camel caps format';
            $data = array( $varName );
            $phpcsFile->addError( $error, $stackPtr, 'MemberVarNotCamelCaps',
                $data );
        }
        else if ( preg_match( '|\d|', $varName ) )
        {
            $warning = 'Variable "%s" contains numbers but this is discouraged';
            $data = array( $varName );
            $phpcsFile->addWarning( $warning, $stackPtr,
                'MemberVarContainsNumbers', $data );
        }
    }
1326958
protected function isSprykerNamespace(File $phpCsFile, int $stackPointer): bool
    {
        $firstNamespaceTokenPosition = $phpCsFile->findNext(T_STRING, $stackPointer);
        if ($firstNamespaceTokenPosition) {
            $firstNamespaceString = $phpCsFile->getTokens()[$firstNamespaceTokenPosition]['content'];
            $secondNamespaceTokenPosition = $phpCsFile->findNext(T_STRING, $firstNamespaceTokenPosition + 1);

            if (!$secondNamespaceTokenPosition) {
                return false;
            }

            $secondNamespaceString = $phpCsFile->getTokens()[$secondNamespaceTokenPosition]['content'];
            $isSprykerClass = (in_array($firstNamespaceString, $this->sprykerNamespaces) && in_array($secondNamespaceString, $this->sprykerApplications));
            $isSprykerTestClass = in_array($firstNamespaceString, $this->sprykerTestNamespaces) && in_array($secondNamespaceString, $this->sprykerApplications);

            return ($isSprykerClass || $isSprykerTestClass);
        }

        return false;
    }