Returns the validation rules for the comment

@param string $commentableType The namespaced model that is being commented on
@return array
162911
public function getRules($commentableType)
	{
		$commentableObj = new $commentableType;
		$table = $commentableObj->getTable();
		$key = $commentableObj->getKeyName();
		$rules = array(
			'commentable_type' => 'required|in:'.implode(',', Config::get('laravel-comments::commentables')),
			'commentable_id' => 'required|exists:'.$table.','.$key,
			'comment' => 'required',
		);
		return $rules;
	}
441270
public function getNumValidatedComments()
    {
        $count = (new CommentManager())
            ->filter("article = %i", array($this->getId()))
            ->filter("active = 1")
            ->filter("spam = 0 ");

        $validation = BaseManager::build('FelixOnline\Core\EmailValidation', 'email_validation')
            ->filter("confirmed = 1");

        $count->join($validation, null, 'email', 'email');
        $num = 0;

        $count = $count->values();

        if ($count) {
            foreach ($count as $item) {
                if ($item->isAccessible()) {
                    $num++;
                }
            }
        }

        return $num;
    }
550515
public function getValidAttribs()
    {
        return array_combine(
            array_keys($this->validAttribs),
            array_map(function ($ref) {
                return $ref['attrib'];
            }, array_values($this->validAttribs))
        );
    }
1229233
protected function getOptionAndComment($optionKey, $commentPattern): array
    {
        $option = (array)$this->input->getOption($optionKey);

        if (count($option) > 0) {
            $this->output->note(sprintf($commentPattern, implode(', ', $option)));
        }

        return $option;
    }
1308223
protected function getFormattedErrors(ConstraintViolationListInterface $constraintViolations,
                                          callable $formatter = null)
    {
        $errors = [];

        if (is_null($formatter)) {
            $formatter = function(ConstraintViolationInterface $constraintViolation) {
                return new Entity\Error($constraintViolation->getPropertyPath(), $constraintViolation->getMessage());
            };
        }

        /** @var ConstraintViolationInterface $constraintViolation */
        foreach ($constraintViolations as $constraintViolation) {
            $errors[] = $formatter($constraintViolation);
        }

        return $errors;
    }
20508
function getCommentSQL ($xmldb_table) {

        $comment = "COMMENT ON TABLE " . $this->getTableName($xmldb_table);
        $comment.= " IS '" . $this->addslashes(substr($xmldb_table->getComment(), 0, 250)) . "'";

        return array($comment);
    }
1289119
public function getValidationRules()
    {
        $rules = parent::getValidationRules();

        foreach ($rules as &$rule) {
            if ($rule !== '_unique') {
                continue;
            }

            $model = $this->resolvePath();
            $table = $model->getTable();

            $rule = 'unique:'.$table.','.$this->getModelAttributeKey();
            if ($model->exists) {
                $rule .= ','.$model->getKey();
            }
        }
        unset($rule);

        return [$this->getPath() => $rules];
    }
396907
private function getCommentPeopleIDs(TranslatableCommentEntity $comment)
    {
        $result = [];
        $author = $comment->getPostedBy();
        if ($author !== null) {
            $result[] = $author->getUserID();
        }
        foreach ($comment->getChildComments() as $childComment) {
            $result = array_merge($result, $this->getCommentPeopleIDs($childComment));
        }

        return $result;
    }
87211
public function getSenderTypeAllowableValues()
    {
        return [
            self::SENDER_TYPE_CHARACTER,
            self::SENDER_TYPE_CORPORATION,
            self::SENDER_TYPE_ALLIANCE,
            self::SENDER_TYPE_FACTION,
            self::SENDER_TYPE_OTHER,
        ];
    }
979829
public function listComments(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/comments',
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
    }
1163585
def for_entity(obj, check_commentable=False):
    """"""
    if check_commentable and not is_commentable(obj):
        return []

    return getattr(obj, ATTRIBUTE)
716626
public function addComment(NodeInterface $commentableNode, CommentDtoInterface $comment)
    {
        if (!$this->isCommentableNode($commentableNode)) {
            throw new InvalidNodeTypeException('The commentable node type should implement the mixin '.self::COMMENTABLE_NODE_TYPE, 1536244558);
        }

        $this->createNode($commentableNode->getNode('comments'), $comment);
    }
923027
public function getCommentForm()
    {
        $postId = $_POST['postId'] ?? null;
        $commentId = $_POST['commentId'] ?? null;

        if (!$commentId || !$postId || !$comment = get_comment($commentId)) {
            wp_send_json_error('Missing variables');
        }

        if (!$comment = get_comment($commentId)) {
            wp_send_json_error('Comment is missing');
        }

        $args = array(
            'id_form' => 'commentupdate',
            'class_submit' => 'btn btn-sm btn-primary',
            'title_reply' => '',
            'title_reply_before' => '',
            'title_reply_after' => '',
            'label_submit' => __('Update', 'municipio'),
            'logged_in_as' => '',
            'comment_field' => '<textarea id="update-comment" name="comment" cols="45" rows="8" aria-required="true">' . $comment->comment_content . '</textarea>',
            'comment_notes_after' => '<input type="hidden" name="commentId" value="' . $commentId . '">
            <input type="hidden" name="nonce" value="' . wp_create_nonce("update-comment_$commentId") . '">',
            'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" /> <a href="#" class="cancel-update-comment gutter gutter-left gutter-sm"><small>' . __('Cancel', 'municipio') . '</small></a>'
        );

        ob_start();
        comment_form($args, $postId);
        $form = ob_get_clean();
        $form = str_replace('class="comment-respond"', 'class="comment-respond comment-respond-new comment-update"', $form);
        $form = str_replace('id="respond"', 'id="respond-edit"', $form);

        wp_send_json_success($form);
    }
291693
public function getAnnotationsByType($type)
    {
        $annotations = [];
        foreach ($this->annotations as $an) {
            if ($an->getName() == $type) {
                $annotations[] = $an;
            }
        }

        return $annotations;
    }
1240375
public function getErrorsByType(string $type): array
    {
        return array_filter(
            $this->getMessages(),
            function (LogMessage $message) use ($type) {
                return $message->getLevel() === $type;
            }
        );
    }
532541
public static function get_editable_types($context = null) {

        if (empty($context)) {
            $context = context_system::instance();
        }

        $types= repository::get_types(true);
        $editabletypes = array();
        foreach ($types as $type) {
            $instanceoptionnames = repository::static_function($type->get_typename(), 'get_instance_option_names');
            if (!empty($instanceoptionnames)) {
                if ($type->get_contextvisibility($context)) {
                    $editabletypes[]=$type;
                }
             }
        }
        return $editabletypes;
    }
623313
protected function getCompatibilityComment()
    {
        $compatibilityComment = null;

        foreach ($this->getCommentSections() as $commentSection) {
            // Compatible in IE6+, Firefox 2+, Safari 4+.
            // Compatibility: IE6+, Firefox 2+, Safari 4+.
            // Compatibility untested.
            if (preg_match('/^\s*Compatib(le|ility):?\s+/i', $commentSection)) {
                $compatibilityComment = $commentSection;
                break;
            }
        }

        return $compatibilityComment;
    }