1 | <?php |
||
17 | class SitemapBuilder |
||
18 | { |
||
19 | /* ----------------------------------------------------------------- |
||
20 | | Main Methods |
||
21 | | ----------------------------------------------------------------- |
||
22 | */ |
||
23 | |||
24 | /** |
||
25 | * Create the builder instance. |
||
26 | * |
||
27 | * @return \Arcanedev\LaravelSitemap\SitemapBuilder |
||
28 | */ |
||
29 | 66 | public static function make() |
|
33 | |||
34 | /** |
||
35 | * Build the sitemap. |
||
36 | * |
||
37 | * @param string|null $name |
||
38 | * @param \Illuminate\Support\Collection $sitemaps |
||
39 | * @param string $format |
||
40 | * |
||
41 | * @throws \Throwable |
||
42 | * |
||
43 | * @return string|null |
||
44 | */ |
||
45 | 66 | public function build(?string $name, Collection $sitemaps, string $format): ?string |
|
65 | |||
66 | /* ----------------------------------------------------------------- |
||
67 | | Other Methods |
||
68 | | ----------------------------------------------------------------- |
||
69 | */ |
||
70 | |||
71 | /** |
||
72 | * Build a single sitemap item. |
||
73 | * |
||
74 | * @param string $format |
||
75 | * @param \Arcanedev\LaravelSitemap\Contracts\Entities\Sitemap|null $sitemap |
||
76 | * @param string|null $key |
||
77 | * |
||
78 | * @throws \Throwable |
||
79 | * |
||
80 | * @return string|null |
||
81 | */ |
||
82 | 54 | protected function renderSitemap(string $format, Sitemap $sitemap = null, string $key = null) |
|
97 | |||
98 | /** |
||
99 | * Render sitemap index. |
||
100 | * |
||
101 | * @param string $format |
||
102 | * @param \Illuminate\Support\Collection $sitemaps |
||
103 | * |
||
104 | * @throws \Throwable |
||
105 | * |
||
106 | * @return string|null |
||
107 | */ |
||
108 | 48 | protected function renderSitemapIndex(string $format, Collection $sitemaps): ?string |
|
112 | |||
113 | /** |
||
114 | * Render the file. |
||
115 | * |
||
116 | * @param string $format |
||
117 | * @param string $type |
||
118 | * @param array $data |
||
119 | * |
||
120 | * @throws \Throwable |
||
121 | * |
||
122 | * @return string|null |
||
123 | */ |
||
124 | 60 | protected function render(string $format, string $type, array $data): ?string |
|
140 | |||
141 | /** |
||
142 | * Render the xml file. |
||
143 | * |
||
144 | * @param string $format |
||
145 | * @param string $type |
||
146 | * @param array $data |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | 42 | protected function renderXml(string $format, string $type, array $data): string |
|
160 | |||
161 | /** |
||
162 | * Render with illuminate. |
||
163 | * |
||
164 | * @param string $type |
||
165 | * @param string $format |
||
166 | * @param array $data |
||
167 | * |
||
168 | * @throws \Throwable |
||
169 | * |
||
170 | * @return string |
||
171 | */ |
||
172 | 54 | protected function renderView(string $type, string $format, array $data): string |
|
176 | } |
||
177 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: