/**
  * Analyze the content
  *
  * @param string $content
  *
  * @return \IC\Gherkinics\Feedback\FileFeedback
  */
 public function analyze($content)
 {
     $tokenList = $this->lexer->analyze($content);
     $fileFeedback = new FileFeedback($tokenList);
     foreach ($this->analyzerList as $analyzer) {
         $fileFeedback->setCurrentToken(null);
         $analyzer->analyze($tokenList, $fileFeedback);
     }
     return $fileFeedback;
 }
 /**
  * Validate a tag line
  *
  * @param \IC\Gherkinics\Model\Token           $token        token
  * @param \IC\Gherkinics\Feedback\FileFeedback $fileFeedback file feedback
  */
 private function validateTagLine(Model\Token $token, FileFeedback $fileFeedback)
 {
     if (!$token instanceof Model\TagLine) {
         return;
     }
     foreach ($token->getTagList() as $tag) {
         $startWithAtSign = preg_match('/^\\@/', $tag->getName());
         if (!$startWithAtSign) {
             $fileFeedback->add($token->makeComment('Given "' . $tag->getName() . '", please prefix this tag with "@"'));
         }
         if (preg_match('/[A-Z]/', $tag->getName())) {
             $fileFeedback->add($token->makeComment('Given "' . $tag->getName() . '", please only use lowercase'));
         }
         if (preg_match('/_/', $tag->getName())) {
             $fileFeedback->add($token->makeComment('Given "' . $tag->getName() . '", please use hyphen instead of underscore'));
         }
         if (preg_match('/-{2,}/', $tag->getName())) {
             $fileFeedback->add($token->makeComment('Given "' . $tag->getName() . '", please use only one hyphen'));
         }
         if ($startWithAtSign && !preg_match('/^[a-zA-Z0-9]/', substr($tag->getName(), 1))) {
             $fileFeedback->add($token->makeComment('Given "' . $tag->getName() . '", the tag name must start with an alphanumeric character'));
         }
         if (!preg_match('/[a-zA-Z0-9]$/', $tag->getName())) {
             $fileFeedback->add($token->makeComment('Given "' . $tag->getName() . '", the tag name must end with an alphanumeric character'));
         }
     }
 }
 /**
  * Assert for the semantic quality
  *
  * {@internal This method is made publicly accessible to allow a focus and easy test case. }}
  *
  * @param \IC\Gherkinics\Model\Token           $token        token
  * @param \IC\Gherkinics\Feedback\FileFeedback $fileFeedback file feedback
  */
 public function assertSemanticQuality(Model\Token $token, FileFeedback $fileFeedback)
 {
     $isPossibleAction = preg_match('/ (fill|click|select|follow) /', $token->getContext());
     $isPossibleAssertion = preg_match('/ (must|should) /', $token->getContext());
     if ($isPossibleAction && !$isPossibleAssertion && !($token instanceof Model\Action || $this->previousToken instanceof Model\Action && $token instanceof Model\Continuation || $token instanceof Model\Precondition || $this->previousToken instanceof Model\Precondition && $token instanceof Model\Continuation)) {
         $fileFeedback->add($token->makeComment('The context suggests an precondition/action but the prefix does not'));
     }
     if ($isPossibleAssertion && !$isPossibleAction && !$token instanceof Model\Assertion && !($this->previousToken instanceof Model\Assertion && $token instanceof Model\Continuation)) {
         $fileFeedback->add($token->makeComment('The context suggests an assertion but the prefix does not'));
     }
 }
 /**
  * Validate indentation
  *
  * @param \IC\Gherkinics\Model\Token           $token        token
  * @param \IC\Gherkinics\Feedback\FileFeedback $fileFeedback file feedback
  */
 private function assertExtraWhitespaces(Model\Token $token, FileFeedback $fileFeedback)
 {
     if ($token instanceof Model\TabularData) {
         return;
     }
     $actualContext = trim($token->getRawContent());
     if (preg_match('/\\s{2,}/', $actualContext)) {
         $fileFeedback->add($token->makeComment('Extra whitespaces'));
     }
 }