Skip to content

Instantly share code, notes, and snippets.

@olleharstedt
Created April 23, 2023 09:13
Show Gist options
  • Select an option

  • Save olleharstedt/c140970d536a3799ef888c503864b34a to your computer and use it in GitHub Desktop.

Select an option

Save olleharstedt/c140970d536a3799ef888c503864b34a to your computer and use it in GitHub Desktop.

Revisions

  1. olleharstedt created this gist Apr 23, 2023.
    30 changes: 30 additions & 0 deletions pipetest.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    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'));
    }