Skip to content

Instantly share code, notes, and snippets.

@olleharstedt
Last active April 24, 2023 11:38
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/353bab536750d7ec5a717f54c12e185a to your computer and use it in GitHub Desktop.
Save olleharstedt/353bab536750d7ec5a717f54c12e185a to your computer and use it in GitHub Desktop.
<?php
function getAttributesFromTheme(string $themeName)
{
$theme = $this->getTheme($themeName);
if (empty($theme)) {
return null;
}
$xml = $this->getXmlFromTheme($theme);
if (empty($xml)) {
return null;
}
return $this->extractAttributes($xml);
}
function caller()
{
$attributes = $this->getAttributesFromTheme('mytheme');
}
function getAttributesFromTheme(string $themeName)
{
return Pipe::make(
$this->getTheme(...),
$this->getXmlFromTheme(...),
$this->extractAttributes(...)
)
->stopIfEmpty()
->from($themeName);
}
function caller()
{
$attributes = $this->getAttributesFromTheme('mytheme')->run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment