Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
#45 Add abstract tree and string processor class
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Kleinhans committed Dec 13, 2016
1 parent bc1deb8 commit 5f11183
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace StackFormation\PreProcessor\Stage;

abstract class AbstractStringPreProcessorStage
{
protected $stringPreProcessor; // reference to parent

/**
* @param \StackFormation\PreProcessor\StringPreProcessor $stringPreProcessor
*/
public function __construct(\StackFormation\PreProcessor\StringPreProcessor $stringPreProcessor) {
$this->stringPreProcessor = $stringPreProcessor;
}

/**
* @param string $content
* @throws \StackFormation\Exception\StringPreProcessorException
*/
public function __invoke($content)
{
try {
return $this->invoke($content);
} catch (\Exception $e) {

throw new \Exception('TODO create StringPreProcessorException');
// TODO
//throw new \StackFormation\Exception\StringPreProcessorException($content, $e);
}
}

/**
* @param string $content
*/
abstract function invoke($content);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace StackFormation\PreProcessor\Stage;

use StackFormation\PreProcessor\Rootline;

abstract class AbstractTreePreProcessorStage
{
protected $treePreProcessor;
protected $basePath;

/**
* @param \StackFormation\PreProcessor\TreePreProcessor $treePreProcessor
* @param string $basePath
*/
public function __construct(\StackFormation\PreProcessor\TreePreProcessor $treePreProcessor, $basePath) {
$this->treePreProcessor = $treePreProcessor;
$this->basePath = $basePath;
}

public function __invoke() {}

/**
* @param string $path
* @param string $value
* @param Rootline $rootLineReferences
* @return mixed
*/
abstract function invoke($path, $value, Rootline $rootLineReferences);
}

0 comments on commit 5f11183

Please sign in to comment.