src/LINEBot/MessageBuilder/Flex/ComponentBuilder/BoxComponentBuilder.php
public function build()
    {
        if (isset($this->component)) {
            return $this->component;
        }

        $contents = array_map(function ($componentBuilder) {
            /** @var ComponentBuilder $componentBuilder */
            return $componentBuilder->build();
        }, $this->componentBuilders);

        $this->component = BuildUtil::removeNullElements([
            'type' => ComponentType::BOX,
            'layout' => $this->layout,
            'contents' => $contents,
            'flex' => $this->flex,
            'spacing' => $this->spacing,
            'margin' => $this->margin,
            'action' => BuildUtil::build($this->actionBuilder, 'buildTemplateAction'),
        ]);

        return $this->component;
    }
public function build()
    {
        if (isset($this->component)) {
            return $this->component;
        }

        $contents = array_map(function ($componentBuilder) {
            /** @var ComponentBuilder $componentBuilder */
            return $componentBuilder->build();
        }, $this->componentBuilders);

        $this->component = BuildUtil::removeNullElements([
            'type' => ComponentType::BOX,
            'layout' => $this->layout,
            'contents' => $contents,
            'flex' => $this->flex,
            'spacing' => $this->spacing,
            'margin' => $this->margin,
            'action' => BuildUtil::build($this->actionBuilder, 'buildTemplateAction'),
        ]);

        return $this->component;
    }
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ contents = array_map ( function ( $ componentBuilder ) { /** @var ComponentBuilder $componentBuilder */ return $ componentBuilder -> build ( ) ; } , $ this -> componentBuilders ) ; $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: BOX , 'layout' => $ this -> layout , 'contents' => $ contents , 'flex' => $ this -> flex , 'spacing' => $ this -> spacing , 'margin' => $ this -> margin , 'action' => BuildUtil :: build ( $ this -> actionBuilder , 'buildTemplateAction' ) , ] ) ; return $ this -> component ; }
Builds box component structure.

@return array
Builds box component structure .