Skip to content

Commit

Permalink
Merge pull request #6 from theiconic/feature/json-parser
Browse files Browse the repository at this point in the history
add JsonParser
  • Loading branch information
wyrfel authored Dec 5, 2016
2 parents 6ca7256 + 85ef101 commit 0302bf8
Show file tree
Hide file tree
Showing 6 changed files with 1,576 additions and 6 deletions.
31 changes: 31 additions & 0 deletions src/Parser/JsonParser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace TheIconic\Fixtures\Parser;

use TheIconic\Fixtures\Fixture\Fixture;

/**
* Class JsonParser
* @package TheIconic\Fixtures\Parser
*/
class JsonParser extends AbstractParser
{
/**
* Yaml extension
* @var string
*/
protected static $parsableExtension = '.json';

/**
* Parses a Yaml file.
*
* @param $source
* @return Fixture
*/
public function parse($source)
{
$fixtureArray = json_decode(file_get_contents($source), true);

return Fixture::create($fixtureArray);
}
}
Loading

0 comments on commit 0302bf8

Please sign in to comment.