public function findRequiredTokens(FinderInterface $finder, array $tokenCollection)
    {
        foreach ($tokenCollection as $fileTokens) {
            if (!$fileTokens->hasTokens()) {
                continue;
            }
            $file = $this->plugin->directory.'/'.$fileTokens->file;

            if (!file_exists($file)) {
                $this->addWarning(sprintf('Skipping validation of missing or optional file: %s', $fileTokens->file));
                continue;
            }

            try {
                $finder->findTokens($file, $fileTokens);
                $this->addMessagesFromTokens($finder->getType(), $fileTokens);
            } catch (\Exception $e) {
                $this->addError($e->getMessage());
            }
        }
    }
public function findRequiredTokens(FinderInterface $finder, array $tokenCollection)
    {
        foreach ($tokenCollection as $fileTokens) {
            if (!$fileTokens->hasTokens()) {
                continue;
            }
            $file = $this->plugin->directory.'/'.$fileTokens->file;

            if (!file_exists($file)) {
                $this->addWarning(sprintf('Skipping validation of missing or optional file: %s', $fileTokens->file));
                continue;
            }

            try {
                $finder->findTokens($file, $fileTokens);
                $this->addMessagesFromTokens($finder->getType(), $fileTokens);
            } catch (\Exception $e) {
                $this->addError($e->getMessage());
            }
        }
    }
public function findRequiredTokens ( FinderInterface $ finder , array $ tokenCollection ) { foreach ( $ tokenCollection as $ fileTokens ) { if ( ! $ fileTokens -> hasTokens ( ) ) { continue ; } $ file = $ this -> plugin -> directory . '/' . $ fileTokens -> file ; if ( ! file_exists ( $ file ) ) { $ this -> addWarning ( sprintf ( 'Skipping validation of missing or optional file: %s' , $ fileTokens -> file ) ) ; continue ; } try { $ finder -> findTokens ( $ file , $ fileTokens ) ; $ this -> addMessagesFromTokens ( $ finder -> getType ( ) , $ fileTokens ) ; } catch ( \ Exception $ e ) { $ this -> addError ( $ e -> getMessage ( ) ) ; } } }
Find required tokens in a file.

@param FinderInterface $finder
@param FileTokens[]    $tokenCollection
Find required tokens in a file .