Skip to content

Instantly share code, notes, and snippets.

@olleharstedt
Created April 23, 2023 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olleharstedt/c140970d536a3799ef888c503864b34a to your computer and use it in GitHub Desktop.
Save olleharstedt/c140970d536a3799ef888c503864b34a to your computer and use it in GitHub Desktop.
function getAttributesFromTheme(string $themeName)
{
$theme = $this->getTheme($themeName);
if (empty($theme)) {
return null;
}
$xml = $this->getXmlFile($theme->path);
if (empty($xml)) {
return null;
}
return $this->extractAttributes($xml);
}
function caller()
{
$attributes = getAttributesFromTheme('mytheme');
}
function getAttributesFromTheme()
{
return Pipe::make(
$this->getXmlFile(...),
$this->extractAttributes(...)
)->stopIfEmpty();
}
function caller()
{
$attributes = getAttributesFromTheme()->run(getTheme('mytheme'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment