This repository has been archived by the owner on Sep 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#45 Add abstract tree and string processor class
- Loading branch information
Julian Kleinhans
committed
Dec 13, 2016
1 parent
bc1deb8
commit 5f11183
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/StackFormation/PreProcessor/Stage/AbstractStringPreProcessorStage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
30 changes: 30 additions & 0 deletions
30
src/StackFormation/PreProcessor/Stage/AbstractTreePreProcessorStage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |