public function build()
    {
        $this->checkIfOneTopicExist();

        if ($this->hasOnlyOneTopic()) {
            foreach ($this->conditions[0] as $topic) {
                return '/topics/'.$topic;
            }
        }

        return [
            'condition' => $this->topicsForFcm($this->conditions),
        ];
    }
public function build()
    {
        $this->checkIfOneTopicExist();

        if ($this->hasOnlyOneTopic()) {
            foreach ($this->conditions[0] as $topic) {
                return '/topics/'.$topic;
            }
        }

        return [
            'condition' => $this->topicsForFcm($this->conditions),
        ];
    }
public function build ( ) { $ this -> checkIfOneTopicExist ( ) ; if ( $ this -> hasOnlyOneTopic ( ) ) { foreach ( $ this -> conditions [ 0 ] as $ topic ) { return '/topics/' . $ topic ; } } return [ 'condition' => $ this -> topicsForFcm ( $ this -> conditions ) , ] ; }
Transform to array.

@return array|string

@throws NoTopicProvided
Transform to array .