Skip to content

Commit

Permalink
Release 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Taluu committed Nov 18, 2013
2 parents 9273ae6 + 0e04c56 commit 071d065
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 34 deletions.
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,30 @@ Totem
[![Build Status](https://travis-ci.org/Taluu/Totem.png?branch=develop)](https://travis-ci.org/Taluu/Totem)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/Taluu/Totem/badges/quality-score.png?s=b71f67e353a379e19b651697285ffed18d6f1554)](https://scrutinizer-ci.com/g/Taluu/Totem/)
[![Code Coverage](https://scrutinizer-ci.com/g/Taluu/Totem/badges/coverage.png?s=526dc791403caf731f6abb78d713291c68cf8446)](https://scrutinizer-ci.com/g/Taluu/Totem/)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/5d97b609-b57c-467e-9a6e-3a39e08bd825/mini.png)](https://insight.sensiolabs.com/projects/5d97b609-b57c-467e-9a6e-3a39e08bd825)

Changeset calculator between two state of a data.

Compatible PHP >= 5.4

Snapshots currently supported :
- Object
- Array

Everything happens on the develop branch ; the master branch is for hotfixes or
releases only !
```
\\\\////
|.)(.|
| || |
\(__)/ Changeset calculator between two state of a data
|-..-| Requires PHP 5.4 ; Compatible PHP 5.5
|o\/o|
.----\ /----.
/ / / |~~~~| \ \ \
/ / / /|::::|\ \ \ \
'-'-'-'-|::::|-'-'-'-'
(((^^)))
>>><<< Snapshots currently natively supported :
|||||| - Object
(o)(o) - Array
| /\ |
(====) Everything happens on the develop branch ; the master branch
|_/\_| is for releases or hotfixes only !
(_/\_)
_|_,__|
(___\___)
```

Documentation
=============
Expand Down
Empty file modified phpunit.xml
100755 → 100644
Empty file.
4 changes: 0 additions & 4 deletions src/Totem/AbstractChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

namespace Totem;

use \ArrayAccess,
\BadMethodCallException,
\InvalidArgumentException;

/**
* Base class for a Change
*
Expand Down
7 changes: 3 additions & 4 deletions src/Totem/AbstractSnapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

namespace Totem;

use \ArrayAccess,
\ArrayIterator,
\IteratorAggregate,
use \ArrayAccess;

\BadMethodCallException,
use \BadMethodCallException,
\InvalidArgumentException;

use Totem\Exception\IncomparableDataException;
Expand Down Expand Up @@ -131,6 +129,7 @@ final public function offsetUnset($offset)
* Check if the two snapshots are comparable
*
* @param self $snapshot Snapshot to be compared with
*
* @return boolean true if the two snapshots can be processed in a diff, false otherwise
*/
public function isComparable(self $snapshot)
Expand Down
12 changes: 4 additions & 8 deletions src/Totem/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@

use \Countable,
\ArrayAccess,
\ArrayIterator,
\IteratorAggregate,

\OutOfBoundsException,
\BadMethodCallException,
\InvalidArgumentException;

use Totem\AbstractSnapshot,
Totem\Exception\IncomparableDataException,

Totem\Change\Removal,
use Totem\Change\Removal,
Totem\Change\Addition,
Totem\Change\Modification,

Totem\AbstractSnapshot,
Totem\Snapshot\ArraySnapshot,
Totem\Snapshot\ObjectSnapshot;

Expand All @@ -50,7 +46,7 @@ public function __construct(AbstractSnapshot $old, AbstractSnapshot $new)
/**
* Retrieve a property change
*
* @param string $property
* @param string $property
*
* @return AbstractChange Set if it is a recursive change,
* Addition if something was added,
Expand All @@ -71,7 +67,7 @@ public function getChange($property)
/**
* Test if the given property has been changed
*
* @param string $property
* @param string $property
*
* @return boolean
*/
Expand Down
5 changes: 0 additions & 5 deletions src/Totem/Snapshot/ArraySnapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

namespace Totem\Snapshot;

use \ReflectionObject,
\ReflectionProperty,

\InvalidArgumentException;

use Totem\AbstractSnapshot;

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Totem/Snapshot/ObjectSnapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Totem\Snapshot;

use \ReflectionObject,
\ReflectionProperty,

\InvalidArgumentException;

Expand All @@ -29,9 +28,10 @@ class ObjectSnapshot extends AbstractSnapshot
protected $oid;

/**
* Build this snapshot
* Build this snapshot.
*
* @param object $object Object to fix at the current moment
*
* @throws InvalidArgumentException If this is not an object
*/
public function __construct($object)
Expand All @@ -48,6 +48,7 @@ public function __construct($object)
$this->raw = clone $object;
}

/** @var \ReflectionProperty $reflProperty */
foreach ($refl->getProperties() as $reflProperty) {
$reflProperty->setAccessible(true);
$value = $reflProperty->getValue($object);
Expand Down
3 changes: 2 additions & 1 deletion test/Totem/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

class Snapshot extends AbstractSnapshot
{
public function __construct(array $args = []) {
public function __construct(array $args = [])
{
$this->raw = isset($args['raw']) ? $args['raw'] : null;
$this->data = isset($args['data']) ? $args['data'] : [];
$this->comparable = isset($args['comparable']) ? true === $args['comparable'] : null;
Expand Down

0 comments on commit 071d065

Please sign in to comment.