@@ -14,12 +14,22 @@ class BlockCollection extends EntityCollection
1414{
1515 private bool $ showUnsupported = false ;
1616
17+ /**
18+ * will include unsupported blocks within your collection
19+ * unsupported blocks are currently not supported by the Notion API
20+ * they will be ignored (not included) in your collection by default
21+ *
22+ * @return BlockCollection
23+ */
1724 public function withUnsupported (): BlockCollection
1825 {
1926 $ this ->showUnsupported = true ;
2027 return $ this ;
2128 }
2229
30+ /**
31+ * collects all blocks from the raw results (from notion)
32+ */
2333 protected function collectChildren (): void
2434 {
2535 $ this ->collection = new Collection ();
@@ -28,18 +38,29 @@ protected function collectChildren(): void
2838 }
2939 }
3040
41+ /**
42+ * returns according blocks as collection
43+ *
44+ * @return Collection
45+ */
3146 public function asCollection (): Collection
3247 {
33- $ collection =parent ::asCollection ();
48+ $ collection = parent ::asCollection ();
3449 if ($ this ->showUnsupported ) {
3550 return $ collection ;
3651 } else {
37- return $ collection ->filter (function ($ block ){
52+ return $ collection ->filter (function ($ block ) {
3853 return $ block ->getType () != 'unsupported ' ;
3954 });
4055 }
4156 }
4257
58+ /**
59+ * returns according blocks as collection and will only represent the textual content of the blocks
60+ * (this is useful if you only want to work with the blocks content and not with the whole block object)
61+ *
62+ * @return Collection
63+ */
4364 public function asTextCollection (): Collection
4465 {
4566 $ textCollection = new Collection ();
0 commit comments