add enzyme/axiom interfaces
use axiom/RepositoryInterface in tests and store music add axiom/Models/ModelInterface to TuneCollection
This commit is contained in:
11
README.md
11
README.md
@@ -1,3 +1,14 @@
|
||||
AbcParser Library
|
||||
|
||||
convert abc music to and from php objects
|
||||
|
||||
|
||||
###Libraries
|
||||
|
||||
####Axiom
|
||||
https://github.com/enzyme/axiom
|
||||
Interfaces to help with Hexagonal/Domain based design
|
||||
|
||||
####Freckle
|
||||
https://github.com/enzyme/freckle
|
||||
Interpret arrays using dot notation
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
"require": {
|
||||
"codeception/codeception": "^2.2",
|
||||
"zackkitzmiller/tiny": "^1.2",
|
||||
"webpatser/laravel-uuid": "^2.0"
|
||||
"webpatser/laravel-uuid": "^2.0",
|
||||
"enzyme/axiom": "^4.2",
|
||||
"enzyme/freckle": "^0.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
221
composer.lock
generated
221
composer.lock
generated
@@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "23a46e0a07c4770e358d40e41f0013ce",
|
||||
"content-hash": "cdced1eb71a445814db7193fbddd9637",
|
||||
"hash": "7d6809dba18aa5191491dfbec9e760f9",
|
||||
"content-hash": "36e1db11be4cb4e02b3b1a2d09c869ee",
|
||||
"packages": [
|
||||
{
|
||||
"name": "behat/gherkin",
|
||||
@@ -214,6 +214,171 @@
|
||||
],
|
||||
"time": "2015-06-14 21:17:01"
|
||||
},
|
||||
{
|
||||
"name": "enzyme/axiom",
|
||||
"version": "v4.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/enzyme/axiom.git",
|
||||
"reference": "81ba8efa3b27cf9ad277d4f5fb244fdfe160692f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/enzyme/axiom/zipball/81ba8efa3b27cf9ad277d4f5fb244fdfe160692f",
|
||||
"reference": "81ba8efa3b27cf9ad277d4f5fb244fdfe160692f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"enzyme/freckle": "^0.3.0",
|
||||
"enzyme/parrot": "^0.0.1",
|
||||
"icanboogie/inflector": "^1.4",
|
||||
"php": ">=5.5.0",
|
||||
"symfony/console": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.4",
|
||||
"phpunit/phpunit": "^4.8",
|
||||
"satooshi/php-coveralls": "^0.6.1"
|
||||
},
|
||||
"bin": [
|
||||
"bin/axiom"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Enzyme\\Axiom\\": "src/",
|
||||
"Enzyme\\Axiom\\Console\\": "console/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tristan Strathearn",
|
||||
"email": "r3oath@gmail.com",
|
||||
"homepage": "https://github.com/r3oath",
|
||||
"role": "Senior Web Developer"
|
||||
}
|
||||
],
|
||||
"description": "A set of interfaces & classes for creating domain driven projects.",
|
||||
"homepage": "https://github.com/enzyme/axiom",
|
||||
"keywords": [
|
||||
"axiom",
|
||||
"ddd",
|
||||
"enzyme",
|
||||
"hex",
|
||||
"interfaces",
|
||||
"php"
|
||||
],
|
||||
"time": "2016-04-03 08:03:32"
|
||||
},
|
||||
{
|
||||
"name": "enzyme/freckle",
|
||||
"version": "v0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/enzyme/freckle.git",
|
||||
"reference": "c4782eada4217349a26da2ec277717437a92e39b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/enzyme/freckle/zipball/c4782eada4217349a26da2ec277717437a92e39b",
|
||||
"reference": "c4782eada4217349a26da2ec277717437a92e39b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.4",
|
||||
"phpunit/phpunit": "^4.8",
|
||||
"satooshi/php-coveralls": "^0.6.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Enzyme\\Freckle\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tristan Strathearn",
|
||||
"email": "r3oath@gmail.com",
|
||||
"homepage": "https://github.com/r3oath",
|
||||
"role": "Senior Web Developer"
|
||||
}
|
||||
],
|
||||
"description": "A collection of dot-based information retrieval helpers... wuh?",
|
||||
"homepage": "https://github.com/enzyme/freckle",
|
||||
"keywords": [
|
||||
"collections",
|
||||
"dot",
|
||||
"enzyme",
|
||||
"freckle",
|
||||
"information",
|
||||
"path",
|
||||
"retrieval"
|
||||
],
|
||||
"time": "2016-04-03 05:46:18"
|
||||
},
|
||||
{
|
||||
"name": "enzyme/parrot",
|
||||
"version": "v0.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/enzyme/parrot.git",
|
||||
"reference": "e20973c6c48ed88eadbbe382e6f039728b4a9282"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/enzyme/parrot/zipball/e20973c6c48ed88eadbbe382e6f039728b4a9282",
|
||||
"reference": "e20973c6c48ed88eadbbe382e6f039728b4a9282",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.4",
|
||||
"phpunit/phpunit": "^4.8"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Enzyme\\Parrot\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tristan Strathearn",
|
||||
"email": "r3oath@protonmail.ccom",
|
||||
"homepage": "https://github.com/r3oath",
|
||||
"role": "Full Stack Developer"
|
||||
}
|
||||
],
|
||||
"description": "Mockable native static functions for PHP.",
|
||||
"homepage": "https://github.com/enzyme/parrot",
|
||||
"keywords": [
|
||||
"enzyme",
|
||||
"functions",
|
||||
"mockable",
|
||||
"parrot",
|
||||
"php",
|
||||
"primitives",
|
||||
"static"
|
||||
],
|
||||
"time": "2015-12-14 01:16:37"
|
||||
},
|
||||
{
|
||||
"name": "facebook/webdriver",
|
||||
"version": "1.4.1",
|
||||
@@ -447,6 +612,58 @@
|
||||
],
|
||||
"time": "2017-03-20 17:10:46"
|
||||
},
|
||||
{
|
||||
"name": "icanboogie/inflector",
|
||||
"version": "v1.4.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ICanBoogie/Inflector.git",
|
||||
"reference": "a875d3c16215327e1a2555592b167ae2591c5c2f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ICanBoogie/Inflector/zipball/a875d3c16215327e1a2555592b167ae2591c5c2f",
|
||||
"reference": "a875d3c16215327e1a2555592b167ae2591c5c2f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.3.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"lib/"
|
||||
],
|
||||
"files": [
|
||||
"lib/helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Olivier Laviale",
|
||||
"email": "olivier.laviale@gmail.com",
|
||||
"homepage": "http://www.weirdog.com/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Multilingual inflector that transforms words from singular to plural, underscore to camel case, and more.",
|
||||
"homepage": "http://icanboogie.org/",
|
||||
"keywords": [
|
||||
"camelize",
|
||||
"hyphenate",
|
||||
"inflect",
|
||||
"multilingual",
|
||||
"pluralize",
|
||||
"singularize",
|
||||
"underscore"
|
||||
],
|
||||
"time": "2017-06-30 13:16:14"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.6.1",
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: richard
|
||||
* Date: 10/16/17
|
||||
* Time: 6:14 AM
|
||||
*/
|
||||
|
||||
namespace XaiCorp\AbcParser\Interfaces;
|
||||
|
||||
|
||||
interface Repository
|
||||
{
|
||||
public function store($entity);
|
||||
|
||||
public function get($id);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace XaiCorp\AbcParser\Models\Memory;
|
||||
use XaiCorp\AbcParser\Interfaces\Builder;
|
||||
use XaiCorp\AbcParser\Interfaces\Exporter;
|
||||
use XaiCorp\AbcParser\Interfaces\Manipulator;
|
||||
use Enzyme\Axiom\Repositories\RepositoryInterface;
|
||||
|
||||
class Abc implements Builder
|
||||
{
|
||||
@@ -13,6 +14,22 @@ class Abc implements Builder
|
||||
|
||||
protected $currentSetting;
|
||||
|
||||
protected $tuneRepository;
|
||||
|
||||
protected $settingRepository;
|
||||
|
||||
protected $personRepository;
|
||||
|
||||
/**
|
||||
* @var \XaiCorp\AbcParser\Interfaces\Repository
|
||||
*/
|
||||
protected $collectionRepository;
|
||||
|
||||
public function __construct(RepositoryInterface $collectionRepository)
|
||||
{
|
||||
$this->collectionRepository = $collectionRepository;
|
||||
}
|
||||
|
||||
public function newCollection()
|
||||
{
|
||||
$this->collection = new TuneCollection();
|
||||
@@ -73,6 +90,8 @@ class Abc implements Builder
|
||||
$this->currentSetting->set('music', trim($music));
|
||||
$this->currentTune->append('collection', $this->currentSetting);
|
||||
$this->collection->append('collection', $this->currentTune);
|
||||
//TODO: save to repositories
|
||||
|
||||
// save to repositories
|
||||
$this->collectionRepository->add($this->collection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace XaiCorp\AbcParser\Models\Memory;
|
||||
|
||||
use Enzyme\Axiom\Models\ModelInterface;
|
||||
|
||||
/**
|
||||
* TuneCollection represents a collection of tunes, such a book, manuscript
|
||||
* or abc file.
|
||||
@@ -8,7 +10,8 @@ namespace XaiCorp\AbcParser\Models\Memory;
|
||||
* a collection can have various parameters to define the collection
|
||||
* in addition to the list of tunes
|
||||
*/
|
||||
class TuneCollection extends BaseIterator {
|
||||
class TuneCollection extends BaseIterator implements ModelInterface
|
||||
{
|
||||
|
||||
private $tc_id = 0; // collection id
|
||||
private $cOwner; // collection owner. The user that uploaded it
|
||||
@@ -267,5 +270,47 @@ class TuneCollection extends BaseIterator {
|
||||
return md5(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique identity for this mode.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function identity()
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this model has the given attribute set.
|
||||
*
|
||||
* @param string $attribute
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function has($attribute)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the value associated with the given attribute.
|
||||
// *
|
||||
// * @param string $attribute
|
||||
// *
|
||||
// * @return mixed
|
||||
// */
|
||||
// public function get($attribute)
|
||||
// {
|
||||
// //TODO:
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get all the attributes associated with this model.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
namespace Tests\Unit\Memory;
|
||||
|
||||
use XaiCorp\AbcParser\Interfaces\Repository;
|
||||
use XaiCorp\AbcParser\Models\Memory\Abc;
|
||||
use XaiCorp\AbcParser\Models\Memory\Person;
|
||||
use XaiCorp\AbcParser\Parser as AbcParser;
|
||||
use Enzyme\Axiom\Repositories\RepositoryInterface;
|
||||
|
||||
class AbcParserTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
@@ -12,7 +14,11 @@ class AbcParserTest extends \Codeception\TestCase\Test
|
||||
public function setUp()
|
||||
{
|
||||
parent::setup();
|
||||
$this->facade = new AbcParser(new Abc());
|
||||
|
||||
$repository = \Mockery::mock(RepositoryInterface::class)
|
||||
->shouldReceive('add')->once()
|
||||
->getMock();
|
||||
$this->facade = new AbcParser(new Abc($repository));
|
||||
}
|
||||
|
||||
private function getValidAbc($filename = '/abc/valid_abc_1.abc')
|
||||
|
||||
Reference in New Issue
Block a user