setResourceURI($resourceURI); $this->createCSS(); $this->createJS(); } protected function createCSS(){} protected function createJS(){} public function setResourceURI(string $resourceURI): void { $this->resourceURI = $resourceURI; } public function registerJS(string $slug, string $resource, bool $body = true, bool $addResourceURI = true, string $after = null): void { $resource = $addResourceURI ? $this->resourceURI . $resource : $resource; if ($body) { $this->jsBody[$slug] = $resource; } else { $this->jsHeader[$slug] = $resource; } $this->collectorJs[$slug] = ['resource' => $resource, 'after' => $after, 'body' => $body]; } public function registerCSS(string $slug, string $resource, bool $addResourceURI = true, string $after = null): void { $resource = $addResourceURI ? $this->resourceURI . $resource : $resource; $this->css[$slug] = $resource; $this->collectorCss[$slug] = ['resource' => $resource, 'after' => $after]; } public function getJSAsStr(bool $body = true): void { if ($body) { foreach ($this->jsBody as $key => $item){ echo ""; } } else { foreach ($this->jsHeader as $key => $item){ echo ""; } } } public function getCSSAsSTR(): void { foreach ($this->css as $key => $item){ echo ""; } } public function getCollectorCss(): array { return $this->collectorCss; } public function getCollectorJs(): array { return $this->collectorJs; } }