Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove functionality that is specific to data #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).

_..._

## 2.3.0 - 2016-04-04

- Split `ProtectedValueObjectTrait` functionality from `ImmutableValueObjectTrait`

## 2.2.0 - 2016-03-31

* Add `PartialRepositoryInterface`

## 2.1.0 - 2016-03-25

* Modify `RepositoryInterface` to support `Traversable` return values

## 2.0.0 - 2016-03-24

* Add `findByIds()` method to `RepositoryInterface`

## 1.2.0 - 2016-01-19

* Add `CountRepositoryInterface`

## 1.1.0 - 2016-01-14

* Add `DiffableEntityTrait`

## 1.0.0 - 2016-01-05

* Changed from `Spark` to `Equip` namespace
* Extract immutable traits from `equip/data` package
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Equip Data
## Equip Immutable

[![Latest Stable Version](https://img.shields.io/packagist/v/equip/data.svg)](https://packagist.org/packages/equip/data)
[![License](https://img.shields.io/packagist/l/equip/data.svg)](https://github.com/equip/data/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/equip/data.svg)](https://travis-ci.org/equip/data)
[![Code Coverage](https://scrutinizer-ci.com/g/equip/data/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/equip/data/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/equip/data/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/equip/data/?branch=master)
[![Latest Stable Version](https://img.shields.io/packagist/v/equip/immutable.svg)](https://packagist.org/packages/equip/immutable)
[![License](https://img.shields.io/packagist/l/equip/immutable.svg)](https://github.com/equip/immutable/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/equip/immutable.svg)](https://travis-ci.org/equip/immutable)
[![Code Coverage](https://scrutinizer-ci.com/g/equip/immutable/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/equip/immutable/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/equip/immutable/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/equip/immutable/?branch=master)

Interfaces and traits for creating a data layer in [Equip](http://equip.github.io/).
Interfaces and traits for creating immutable value objects in [Equip](http://equip.github.io/).
Attempts to be [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/),
and [PSR-4](http://www.php-fig.org/psr/psr-4/) compliant.

For more information, see [the documentation](http://equipframework.readthedocs.org/en/latest/data).
For more information, see [the documentation](http://equipframework.readthedocs.org/en/latest/immutable).
17 changes: 7 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "equip/data",
"description": "Interfaces and traits for creating a data layer",
"name": "equip/immutable",
"description": "Interfaces and traits for immutable value objects",
"type": "library",
"license": "MIT",
"authors": [
Expand All @@ -9,24 +9,21 @@
"homepage": "https://github.com/equip"
}
],
"replace": {
"sparkphp/data": "self.version"
},
"require": {
"php": ">=5.5",
"nesbot/carbon": "^1"
"php": ">=5.5"
},
"require-dev": {
"suggest": {
"phpunit/phpunit": "^4.8|^5.0"
},
"autoload": {
"psr-4": {
"Equip\\Data\\": "src/"
"Equip\\Immutable\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"EquipTests\\Data\\": "tests/"
"Equip\\Immutable\\": "tests/",
"Equip\\Immutable\\Fixture\\": "tests/_fixture/"
}
}
}
4 changes: 2 additions & 2 deletions src/ArraySerializableInterface.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Equip\Data;
namespace Equip\Immutable;

interface ArraySerializableInterface
{
/**
* Get the values of the object as an array
* Get the values of the object as an array.
*
* @return array
*/
Expand Down
23 changes: 23 additions & 0 deletions src/ArraySerializableTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Equip\Immutable;

trait ArraySerializableTrait /* implements ArraySerializableInterface */
{
/**
* Get the values of the object as an array.
*
* Recursively handles any value that can be converted to an array.
*
* @return array
*/
public function toArray()
{
return array_map(static function ($value) {
if ($value instanceof ArraySerializableInterface) {
$value = $value->toArray();
}
return $value;
}, get_object_vars($this));
}
}
15 changes: 0 additions & 15 deletions src/DiffableInterface.php

This file was deleted.

30 changes: 0 additions & 30 deletions src/EntityInterface.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<?php

namespace Equip\Data\Traits;

use Equip\Data\ArraySerializableInterface;
use RuntimeException;
namespace Equip\Immutable;

trait ImmutableValueObjectTrait
{
use ProtectedValueObjectTrait;

/**
* Hydrate the object with new values
*
Expand Down Expand Up @@ -138,19 +133,4 @@ public function has($key)
{
return property_exists($this, $key);
}

/**
* Get the current object values as an array
*
* @return array
*/
public function toArray()
{
return array_map(static function ($value) {
if ($value instanceof ArraySerializableInterface) {
$value = $value->toArray();
}
return $value;
}, get_object_vars($this));
}
}
7 changes: 6 additions & 1 deletion src/Traits/JsonAwareTrait.php → src/JsonAwareTrait.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?php

namespace Equip\Data\Traits;
namespace Equip\Immutable;

trait JsonAwareTrait /* implements JsonSerializable */
{
/**
* @see ArraySerializableInterface
*/
abstract public function toArray();

/**
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Equip\Data\Traits;
namespace Equip\Immutable;

use RuntimeException;

Expand Down
15 changes: 0 additions & 15 deletions src/Repository/CountRepositoryInterface.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/Repository/CreateRepositoryInterface.php

This file was deleted.

35 changes: 0 additions & 35 deletions src/Repository/DeleteRepositoryInterface.php

This file was deleted.

45 changes: 0 additions & 45 deletions src/Repository/PartialRepositoryInterface.php

This file was deleted.

45 changes: 0 additions & 45 deletions src/Repository/RepositoryInterface.php

This file was deleted.

Loading