Skip to content

Commit

Permalink
Minor cleanups for initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve "uru" West committed Jan 18, 2015
1 parent 8abec98 commit 0bebb8c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Change Log

## [Unreleased][unreleased]

## [0.1.0][0.1.0]
### Added
- Initial version

[unreleased]: https://github.com/stevewest/changelog
[0.1.0]: https://github.com/stevewest/changelog/releases/tag/0.1.0
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ChangeLog
=========
# ChangeLog

![Travis Build](https://img.shields.io/travis/stevewest/changelog.svg?style=flat-square)
![Code Coverage](https://img.shields.io/scrutinizer/g/stevewest/changelog.svg?style=flat-square)
Expand All @@ -13,5 +12,25 @@ able to convert those to an object structure to allow them to be modified easily
then written out to a configured output. The output could be to a file on disk or
committed to a git repo.

Everything will be "driver" based so multiple sources, parsers and outputs can be
used as desired.
Everything is adaptor/driver based so multiple sources, parsers and outputs can be
used as desired. There are also plans for a cli script.

## Example

```php
<?php

$provider = new \ChangeLog\Provider\File([
'file' => 'path/to/changelog.md'
]);

$parser = new \ChangeLog\Parser\KeepAChangeLog();

$log = (new \ChangeLog\ChangeLog(
$provider,
$parser
));

// Instance of ChangeLog\Log
var_dump($log);
```
12 changes: 10 additions & 2 deletions src/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ abstract class AbstractProvider implements ProviderInterface
*/
protected $configDefaults = [];

/**
* @param array $config
*/
public function __construct($config = [])
{
$this->setConfig($config);
}

/**
* {@inheritdoc}
*/
public function setConfig(array $config)
public function setConfig($config)
{
$this->config = $config;
}
Expand All @@ -42,7 +50,7 @@ public function setConfig(array $config)
*
* @param string|int $key
*
* @return string
* @return string|array
*/
public function getConfig($key = null)
{
Expand Down
28 changes: 25 additions & 3 deletions src/ChangeLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,33 @@ class ChangeLog
{

/**
* @return bool
* @var ParserInterface
*/
public function returnTrue()
protected $parser;

/**
* @var ProviderInterface
*/
protected $provider;

/**
* @param ProviderInterface $provider
* @param ParserInterface $parser
*/
public function __construct(ProviderInterface $provider, ParserInterface $parser)
{
$this->provider = $provider;
$this->parser = $parser;
}

/**
* @return Log
*/
public function parse()
{
return true;
return $this->parser->parse(
$this->provider->getContent()
);
}

}
2 changes: 1 addition & 1 deletion src/ProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface ProviderInterface
*
* @return void
*/
public function setConfig(array $config);
public function setConfig($config);

/**
* Returns the content of the change log to be parsed.
Expand Down

0 comments on commit 0bebb8c

Please sign in to comment.