Skip to content

Commit

Permalink
(#302) preparation of abstract source for implementing #297
Browse files Browse the repository at this point in the history
  • Loading branch information
carbontwelve committed Feb 23, 2018
1 parent db10c4e commit d7dbbe7
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Modules/Source/AbstractSource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Tapestry\Modules\Source;

use Tapestry\Entities\Permalink;

abstract class AbstractSource implements SourceInterface
{

/**
* File meta data, usually from front matter or site config.
*
* @var array
*/
protected $meta = [];

/**
* The Permalink object attached to this file.
*
* @var Permalink
*/
protected $permalink;

/**
* This is the files rendered content as set by `setRenderedContent`.
*
* @var bool|string
*/
protected $content = false;

}
52 changes: 52 additions & 0 deletions src/Modules/Source/SourceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Tapestry\Modules\Source;

use Tapestry\Entities\Permalink;

interface SourceInterface
{
public function getUid() : string;

public function setUid(string $uid);

public function setData(string $key, $value = null);

public function setDataFromArray(array $data);

public function getData(string $key = null, $default = null);

public function hasData(string $key) : bool;

public function getRawContent() : string;

public function setRenderedContent(string $content);

public function getRenderedContent() : string;

public function getPermalink() : Permalink;

public function getCompiledPermalink() : string;

public function setOverloaded(string $key, $value);

public function getFilename(bool $overloaded = true) : string;

public function getExtension(bool $overloaded = true) : string;

public function hasChanged() : bool;

public function setHasChanged(bool $value = true);

public function isRendered() : bool;

public function setRendered(bool $value = true);

public function isToCopy() : bool;

public function setToCopy(bool $value = true);

public function isIgnored() : bool;

public function setIgnored(bool $value = true);
}
118 changes: 118 additions & 0 deletions src/Modules/Source/SplFileSource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php

namespace Tapestry\Modules\Source;

use Tapestry\Entities\Permalink;

class SplFileSource extends AbstractSource implements SourceInterface
{
public function getUid(): string
{
// TODO: Implement getUid() method.
}

public function setUid(string $uid)
{
// TODO: Implement setUid() method.
}

public function setData(string $key, $value = null)
{
// TODO: Implement setData() method.
}

public function setDataFromArray(array $data)
{
// TODO: Implement setDataFromArray() method.
}

public function getData(string $key = null, $default = null)
{
// TODO: Implement getData() method.
}

public function hasData(string $key): bool
{
// TODO: Implement hasData() method.
}

public function getRawContent(): string
{
// TODO: Implement getRawContent() method.
}

public function setRenderedContent(string $content)
{
// TODO: Implement setRenderedContent() method.
}

public function getRenderedContent(): string
{
// TODO: Implement getRenderedContent() method.
}

public function getPermalink(): Permalink
{
// TODO: Implement getPermalink() method.
}

public function getCompiledPermalink(): string
{
// TODO: Implement getCompiledPermalink() method.
}

public function setOverloaded(string $key, $value)
{
// TODO: Implement setOverloaded() method.
}

public function getFilename(bool $overloaded = true): string
{
// TODO: Implement getFilename() method.
}

public function getExtension(bool $overloaded = true): string
{
// TODO: Implement getExtension() method.
}

public function hasChanged(): bool
{
// TODO: Implement hasChanged() method.
}

public function setHasChanged(bool $value = true)
{
// TODO: Implement setHasChanged() method.
}

public function isRendered(): bool
{
// TODO: Implement isRendered() method.
}

public function setRendered(bool $value = true)
{
// TODO: Implement setRendered() method.
}

public function isToCopy(): bool
{
// TODO: Implement isToCopy() method.
}

public function setToCopy(bool $value = true)
{
// TODO: Implement setToCopy() method.
}

public function isIgnored(): bool
{
// TODO: Implement isIgnored() method.
}

public function setIgnored(bool $value = true)
{
// TODO: Implement setIgnored() method.
}
}

0 comments on commit d7dbbe7

Please sign in to comment.