build() 공개 메소드

Transform to array
public build ( ) : array | string
리턴 array | string
예제 #1
0
 /**
  * get Options transformed
  *
  * @return array
  */
 protected function getOptions()
 {
     $options = $this->options ? $this->options->toArray() : [];
     if ($this->topic && !$this->topic->hasOnlyOneTopic()) {
         $options = array_merge($options, $this->topic->build());
     }
     return $options;
 }
예제 #2
0
 /**
  * @test
  */
 public function it_has_a_complex_topic_condition()
 {
     $target = ['condition' => "'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics) || ('TopicD' in topics && 'TopicE' in topics)"];
     $topics = new Topics();
     $topics->topic('TopicA')->andTopic(function ($condition) {
         $condition->topic('TopicB')->orTopic('TopicC');
     })->orTopic(function ($condition) {
         $condition->topic('TopicD')->andTopic('TopicE');
     });
     $this->assertEquals($target, $topics->build());
 }