Comment example


    protected function sSaveComment($commentData$blogArticleId)
    {
        if (empty($commentData)) {
            throw new Enlight_Exception('sSaveComment #00: Could not save comment');
        }

        $blogCommentModel = new Comment();
        /** @var Blog $blog */
        $blog = $this->getRepository()->find($blogArticleId);
        /** @var Shop $shop */
        $shop = $this->getModelManager()->getReference(Shop::class$this->get('shop')->getId());

        $blogCommentModel->setBlog($blog);
        $blogCommentModel->setCreationDate(new DateTime());
        $blogCommentModel->setActive(false);

        $blogCommentModel->setName($commentData['name']);
        $blogCommentModel->setEmail($commentData['eMail']);
        
if ($this->lexer->current->isA(EmailLexer::S_DOT)) {
            return new InvalidEmail(new DotAtStart()$this->lexer->current->value);
        }
        if ($this->lexer->current->isA(EmailLexer::S_HYPHEN)) {
            return new InvalidEmail(new DomainHyphened('After AT')$this->lexer->current->value);
        }
        return new ValidEmail();
    }

    protected function parseComments(): Result
    {
        $commentParser = new Comment($this->lexer, new DomainComment());
        $result = $commentParser->parse();
        $this->warnings = array_merge($this->warnings, $commentParser->getWarnings());

        return $result;
    }

    protected function doParseDomainPart(): Result
    {
        $tldMissing = true;
        $hasComments = false;
        $domain = '';
        
private function parseDoubleQuote(): Result
    {
        $dquoteParser = new DoubleQuote($this->lexer);
        $parseAgain = $dquoteParser->parse();
        $this->warnings = array_merge($this->warnings, $dquoteParser->getWarnings());

        return $parseAgain;
    }

    protected function parseComments(): Result
    {
        $commentParser = new Comment($this->lexer, new LocalComment());
        $result = $commentParser->parse();
        $this->warnings = array_merge($this->warnings, $commentParser->getWarnings());
        if ($result->isInvalid()) {
            return $result;
        }
        return $result;
    }

    private function validateEscaping(): Result
    {
        //Backslash found
Home | Imprint | This part of the site doesn't use cookies.