Skip to content

Commit

Permalink
Added abstract generator for #315
Browse files Browse the repository at this point in the history
  • Loading branch information
carbontwelve committed Aug 15, 2018
1 parent cb980bc commit b350812
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Modules/Generators/AbstractGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Tapestry\Modules\Generators;

use Tapestry\Entities\Project;
use Tapestry\Modules\Source\SourceInterface;

abstract class AbstractGenerator implements GeneratorInterface
{
/**
* @var SourceInterface
*/
protected $source;

/**
* Set the source that this generator works from.
*
* @param SourceInterface $source
* @return void
*/
public function setSource(SourceInterface $source)
{
$this->source = $source;
}

/**
* Run the generation and return an array of generated
* files (oddly implementing SourceInterface, naming
* things is hard!)
*
* @param Project $project
* @return array|SourceInterface[]
*/
abstract public function generate(Project $project): array;
}

0 comments on commit b350812

Please sign in to comment.