public function updateHashtagsFromBody(AnCommandContext $context)
    {
        $entity = $this->getItem();
        $terms = $this->extractHashtagTerms($entity->body);
        
        if (is_array($terms)) {
            foreach ($entity->hashtags as $hashtag) {
                if (!in_array($hashtag->name, array_map('strtolower', $terms))) {
                    $entity->removeHashtag($hashtag->name);
                }
            }
        }

        foreach ($terms as $term) {
            $entity->addHashtag(trim($term));
        }
    }
public function updateHashtagsFromBody(AnCommandContext $context)
    {
        $entity = $this->getItem();
        $terms = $this->extractHashtagTerms($entity->body);
        
        if (is_array($terms)) {
            foreach ($entity->hashtags as $hashtag) {
                if (!in_array($hashtag->name, array_map('strtolower', $terms))) {
                    $entity->removeHashtag($hashtag->name);
                }
            }
        }

        foreach ($terms as $term) {
            $entity->addHashtag(trim($term));
        }
    }
public function updateHashtagsFromBody ( AnCommandContext $ context ) { $ entity = $ this -> getItem ( ) ; $ terms = $ this -> extractHashtagTerms ( $ entity -> body ) ; if ( is_array ( $ terms ) ) { foreach ( $ entity -> hashtags as $ hashtag ) { if ( ! in_array ( $ hashtag -> name , array_map ( 'strtolower' , $ terms ) ) ) { $ entity -> removeHashtag ( $ hashtag -> name ) ; } } } foreach ( $ terms as $ term ) { $ entity -> addHashtag ( trim ( $ term ) ) ; } }
Extracts hashtag terms from the entity body and updates the entity.

@param AnCommandContext $context

@return void
Extracts hashtag terms from the entity body and updates the entity .