-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from theiconic/feature/json-parser
add JsonParser
- Loading branch information
Showing
6 changed files
with
1,576 additions
and
6 deletions.
There are no files selected for viewing
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,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); | ||
} | ||
} |
Oops, something went wrong.