3030use LINE \Clients \MessagingApi \Model \FlexSpan ;
3131use LINE \Clients \MessagingApi \Model \FlexText ;
3232use LINE \Clients \MessagingApi \Model \URIAction ;
33- use LINE \Constants \ActionType ;
3433use LINE \Constants \Flex \BubbleContainerSize ;
3534use LINE \Constants \Flex \ComponentButtonHeight ;
3635use LINE \Constants \Flex \ComponentButtonStyle ;
4443use LINE \Constants \Flex \ComponentMargin ;
4544use LINE \Constants \Flex \ComponentSpaceSize ;
4645use LINE \Constants \Flex \ComponentSpacing ;
47- use LINE \Constants \Flex \ComponentType ;
48- use LINE \Constants \Flex \ContainerType ;
49- use LINE \Constants \MessageType ;
5046
5147/**
5248 * @SuppressWarnings("PHPMD.CouplingBetweenObjects")
@@ -61,10 +57,8 @@ class FlexSampleRestaurant
6157 public static function get (): FlexMessage
6258 {
6359 return new FlexMessage ([
64- 'type ' => MessageType::FLEX ,
6560 'altText ' => 'Restaurant ' ,
6661 'contents ' => new FlexBubble ([
67- 'type ' => ContainerType::BUBBLE ,
6862 'hero ' => self ::createHeroBlock (),
6963 'body ' => self ::createBodyBlock (),
7064 'footer ' => self ::createFooterBlock (),
@@ -76,13 +70,11 @@ public static function get(): FlexMessage
7670 private static function createHeroBlock (): FlexComponent
7771 {
7872 return new FlexImage ([
79- 'type ' => ComponentType::IMAGE ,
8073 'url ' => 'https://example.com/cafe.png ' ,
8174 'size ' => ComponentImageSize::FULL ,
8275 'aspectRatio ' => ComponentImageAspectRatio::R20TO13 ,
8376 'aspectMode ' => ComponentImageAspectMode::COVER ,
8477 'action ' => new URIAction ([
85- 'type ' => ActionType::URI ,
8678 'label ' => 'cafe hero ' ,
8779 'uri ' => 'https://example.com ' ,
8880 'altUri ' => new AltUri (['desktop ' => 'https://example.com#desktop ' ]),
@@ -93,14 +85,12 @@ private static function createHeroBlock(): FlexComponent
9385 private static function createBodyBlock ()
9486 {
9587 return new FlexBox ([
96- 'type ' => ComponentType::BOX ,
9788 'layout ' => ComponentLayout::VERTICAL ,
9889 'backgroundColor ' => '#fafafa ' ,
9990 'paddingAll ' => '8% ' ,
10091 'contents ' => [
10192 // Title
10293 new FlexText ([
103- 'type ' => ComponentType::TEXT ,
10494 'text ' => 'Brown Cafe ' ,
10595 'weight ' => ComponentFontWeight::BOLD ,
10696 'size ' => ComponentFontSize::XL ,
@@ -114,17 +104,14 @@ private static function createBodyBlock()
114104 private static function createBodyReview (): FlexBox
115105 {
116106 $ goldStar = new FlexIcon ([
117- 'type ' => ComponentType::ICON ,
118107 'url ' => 'https://example.com/gold_star.png ' ,
119108 'size ' => ComponentIconSize::SM ,
120109 ]);
121110 $ grayStar = new FlexIcon ([
122- 'type ' => ComponentType::ICON ,
123111 'url ' => 'https://example.com/gray_star.png ' ,
124112 'size ' => ComponentIconSize::SM ,
125113 ]);
126114 $ point = new FlexText ([
127- 'type ' => ComponentType::TEXT ,
128115 'text ' => '4.0 ' ,
129116 'size ' => ComponentFontSize::SM ,
130117 'color ' => '#999999 ' ,
@@ -133,7 +120,6 @@ private static function createBodyReview(): FlexBox
133120 ]);
134121
135122 return new FlexBox ([
136- 'type ' => ComponentType::BOX ,
137123 'layout ' => ComponentLayout::BASELINE ,
138124 'margin ' => ComponentMargin::MD ,
139125 'contents ' => [$ goldStar , $ goldStar , $ goldStar , $ goldStar , $ grayStar , $ point ],
@@ -143,19 +129,16 @@ private static function createBodyReview(): FlexBox
143129 private static function createBodyInfoBlock (): FlexBox
144130 {
145131 $ place = new FlexBox ([
146- 'type ' => ComponentType::BOX ,
147132 'layout ' => ComponentLayout::BASELINE ,
148133 'spacing ' => ComponentSpacing::SM ,
149134 'contents ' => [
150135 new FlexText ([
151- 'type ' => ComponentType::TEXT ,
152136 'text ' => 'Place ' ,
153137 'color ' => '#aaaaaa ' ,
154138 'size ' => ComponentFontSize::SM ,
155139 'flex ' => 1 ,
156140 ]),
157141 new FlexText ([
158- 'type ' => ComponentType::TEXT ,
159142 'text ' => 'Miraina Tower, 4-1-6 Shinjuku, Tokyo ' ,
160143 'wrap ' => true ,
161144 'color ' => '#666666 ' ,
@@ -165,37 +148,31 @@ private static function createBodyInfoBlock(): FlexBox
165148 ],
166149 ]);
167150 $ time = new FlexBox ([
168- 'type ' => ComponentType::BOX ,
169151 'layout ' => ComponentLayout::BASELINE ,
170152 'spacing ' => ComponentSpacing::SM ,
171153 'contents ' => [
172154 new FlexText ([
173- 'type ' => ComponentType::TEXT ,
174155 'text ' => 'Time ' ,
175156 'color ' => '#aaaaaa ' ,
176157 'size ' => ComponentFontSize::SM ,
177158 'flex ' => 1 ,
178159 ]),
179160 new FlexText ([
180- 'type ' => ComponentType::TEXT ,
181161 'text ' => '10:00 - 23:00 ' ,
182162 'wrap ' => true ,
183163 'color ' => '#666666 ' ,
184164 'size ' => ComponentFontSize::SM ,
185165 'flex ' => 5 ,
186166 'contents ' => [
187167 new FlexSpan ([
188- 'type ' => ComponentType::SPAN ,
189168 'text ' => '10:00 ' ,
190169 ]),
191170 new FlexSpan ([
192- 'type ' => ComponentType::SPAN ,
193171 'text ' => '- ' ,
194172 'color ' => '#a0a0a0 ' ,
195173 'size ' => ComponentFontSize::XS ,
196174 ]),
197175 new FlexSpan ([
198- 'type ' => ComponentType::SPAN ,
199176 'text ' => '23:00 ' ,
200177 ]),
201178 ],
@@ -204,7 +181,6 @@ private static function createBodyInfoBlock(): FlexBox
204181 ]);
205182
206183 return new FlexBox ([
207- 'type ' => ComponentType::BOX ,
208184 'layout ' => ComponentLayout::VERTICAL ,
209185 'margin ' => ComponentMargin::LG ,
210186 'spacing ' => ComponentSpacing::SM ,
@@ -215,31 +191,26 @@ private static function createBodyInfoBlock(): FlexBox
215191 private static function createFooterBlock ()
216192 {
217193 $ callButton = new FlexButton ([
218- 'type ' => ComponentType::BUTTON ,
219194 'style ' => ComponentButtonStyle::LINK ,
220195 'height ' => ComponentButtonHeight::SM ,
221196 'action ' => new URIAction ([
222- 'type ' => ActionType::URI ,
223197 'label ' => 'CALL ' ,
224198 'uri ' => 'https://example.com ' ,
225199 'altUri ' => new AltUri (['desktop ' => 'https://example.com#desktop ' ]),
226200 ]),
227201 ]);
228202 $ websiteButton = new FlexButton ([
229- 'type ' => ComponentType::BUTTON ,
230203 'style ' => ComponentButtonStyle::LINK ,
231204 'height ' => ComponentButtonHeight::SM ,
232205 'action ' => new URIAction ([
233- 'type ' => ActionType::URI ,
234206 'label ' => 'WEBSITE ' ,
235207 'uri ' => 'https://example.com ' ,
236208 'altUri ' => new AltUri (['desktop ' => 'https://example.com#desktop ' ]),
237209 ]),
238210 ]);
239- $ spacer = new FlexSpacer (['type ' => ComponentType:: SPACER , ' size ' => ComponentSpaceSize::SM ]);
211+ $ spacer = new FlexSpacer (['size ' => ComponentSpaceSize::SM ]);
240212
241213 return new FlexBox ([
242- 'type ' => ComponentType::BOX ,
243214 'layout ' => ComponentLayout::VERTICAL ,
244215 'spacing ' => ComponentSpacing::SM ,
245216 'flex ' => 0 ,
0 commit comments