Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cordoval committed Aug 27, 2014
1 parent 725944b commit 5a38496
Show file tree
Hide file tree
Showing 47 changed files with 135 additions and 138 deletions.
14 changes: 7 additions & 7 deletions src/Driver/AbstractActionManager.php
Expand Up @@ -2,12 +2,12 @@

namespace Spy\Timeline\Driver;

use Spy\Timeline\ResolveComponent\ComponentDataResolverInterface;
use Spy\Timeline\Spread\DeployerInterface;
use Spy\Timeline\Model\ActionInterface;
use Spy\Timeline\Model\ComponentInterface;
use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;
use Spy\Timeline\ResolveComponent\ComponentDataResolverInterface;
use Spy\Timeline\ResolveComponent\ValueObject\ResolveComponentModelIdentifier;
use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;
use Spy\Timeline\Spread\DeployerInterface;

abstract class AbstractActionManager implements ActionManagerInterface
{
Expand Down Expand Up @@ -57,7 +57,7 @@ public function create($subject, $verb, array $components = array())
$action = new $this->actionClass();
$action->setVerb($verb);

if (!$subject instanceof ComponentInterface AND !is_object($subject)) {
if (!$subject instanceof ComponentInterface and !is_object($subject)) {
throw new \Exception('Subject must be a ComponentInterface or an object');
}

Expand All @@ -71,9 +71,9 @@ public function create($subject, $verb, array $components = array())
}

/**
* @param ActionInterface $action action
* @param string $type type
* @param mixed $component component
* @param ActionInterface $action action
* @param string $type type
* @param mixed $component component
* @throws \Exception
*/
public function addComponent($action, $type, $component)
Expand Down
4 changes: 2 additions & 2 deletions src/Driver/ActionManagerInterface.php
Expand Up @@ -54,7 +54,7 @@ public function create($subject, $verb, array $components = array());
* Find a component or create it.
*
* @param string|object $model pass an object and second argument will be ignored.
* it'll be replaced by $model->getId();
* it'll be replaced by $model->getId();
* @param null|string|array $identifier pass an array for composite keys.
* @param boolean $flush is component flushed with this method ?
*
Expand All @@ -66,7 +66,7 @@ public function findOrCreateComponent($model, $identifier = null, $flush = true)
* create component.
*
* @param string|object $model pass an object and second argument will be ignored.
* it'll be replaced by $model->getId();
* it'll be replaced by $model->getId();
* @param null|string|array $identifier pass an array for composite keys.
* @param boolean $flush is component flushed with this method ?
*
Expand Down
21 changes: 10 additions & 11 deletions src/Driver/QueryBuilder/Criteria/Asserter.php
Expand Up @@ -4,16 +4,16 @@

class Asserter implements CriteriaInterface
{
CONST ASSERTER_EQUAL = '=';
CONST ASSERTER_NOT_EQUAL = '!=';
CONST ASSERTER_IN = 'IN';
CONST ASSERTER_NOT_IN = 'NOT IN';
CONST ASSERTER_LIKE = 'LIKE';
CONST ASSERTER_NOT_LIKE = 'NOT LIKE';
CONST ASSERTER_LOWER_THAN = '<';
CONST ASSERTER_LOWER_THAN_EQUAL = '<=';
CONST ASSERTER_GREATER_THAN = '>';
CONST ASSERTER_GREATER_THAN_EQUAL = '>=';
const ASSERTER_EQUAL = '=';
const ASSERTER_NOT_EQUAL = '!=';
const ASSERTER_IN = 'IN';
const ASSERTER_NOT_IN = 'NOT IN';
const ASSERTER_LIKE = 'LIKE';
const ASSERTER_NOT_LIKE = 'NOT LIKE';
const ASSERTER_LOWER_THAN = '<';
const ASSERTER_LOWER_THAN_EQUAL = '<=';
const ASSERTER_GREATER_THAN = '>';
const ASSERTER_GREATER_THAN_EQUAL = '>=';

/**
* @var string
Expand Down Expand Up @@ -132,7 +132,6 @@ public function gte($value)
return $this->create(self::ASSERTER_GREATER_THAN_EQUAL, $this->transform($value));
}


/**
* @param string $operator operator
* @param mixed $value value
Expand Down
8 changes: 4 additions & 4 deletions src/Driver/QueryBuilder/Criteria/Operator.php
Expand Up @@ -6,8 +6,8 @@

class Operator implements CriteriaInterface
{
CONST TYPE_AND = 'AND';
CONST TYPE_OR = 'OR';
const TYPE_AND = 'AND';
const TYPE_OR = 'OR';

/**
* @var string
Expand Down Expand Up @@ -89,7 +89,7 @@ public function getCriterias()
*/
public function toArray()
{
$criterias = array_map(function($criteria) {
$criterias = array_map(function ($criteria) {
return $criteria->toArray();
}, $this->getCriterias());

Expand All @@ -105,7 +105,7 @@ public function toArray()
*/
public function fromArray(array $data, QueryBuilderFactory $factory)
{
$criterias = array_map(function($v) use ($factory) {
$criterias = array_map(function ($v) use ($factory) {
if ('operator' == $v['type']) {
return $factory->createOperatorFromArray($v);
} elseif ('expr' == $v['type']) {
Expand Down
6 changes: 3 additions & 3 deletions src/Driver/QueryBuilder/QueryBuilder.php
Expand Up @@ -98,7 +98,7 @@ public function field($field)

/**
* @param string $type type
* @param array $args args
* @param array $args args
*
* @return Operator
*/
Expand Down Expand Up @@ -227,8 +227,8 @@ public function getAvailableFields()
}

/**
* @param array $data data
* @param ActionManagerInterface $actionManager actionManager
* @param array $data data
* @param ActionManagerInterface $actionManager actionManager
* @throws \Exception
* @return $this
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Driver/QueryBuilder/QueryBuilderFactory.php
Expand Up @@ -2,11 +2,11 @@

namespace Spy\Timeline\Driver\QueryBuilder;

use Spy\Timeline\Driver\QueryBuilder\Criteria\CriteriaInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Spy\Timeline\Driver\ActionManagerInterface;
use Spy\Timeline\Driver\QueryBuilder\Criteria\Asserter;
use Spy\Timeline\Driver\QueryBuilder\Criteria\CriteriaInterface;
use Spy\Timeline\Driver\QueryBuilder\Criteria\Operator;
use Symfony\Component\OptionsResolver\OptionsResolver;

class QueryBuilderFactory
{
Expand Down
3 changes: 1 addition & 2 deletions src/Driver/Redis/ActionManager.php
Expand Up @@ -2,14 +2,13 @@

namespace Spy\Timeline\Driver\Redis;

use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;
use Spy\Timeline\Driver\AbstractActionManager;
use Spy\Timeline\Driver\ActionManagerInterface;
use Spy\Timeline\Model\ActionInterface;
use Spy\Timeline\Model\ComponentInterface;
use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;
use Spy\Timeline\ResultBuilder\ResultBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Spy\Timeline\ResolveComponent\ValueObject\ResolveComponentModelIdentifier;

class ActionManager extends AbstractActionManager implements ActionManagerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Redis/Pager/AbstractPager.php
Expand Up @@ -39,7 +39,7 @@ public function findActionsForIds(array $ids)

return array_values(
array_map(
function($v) {
function ($v) {
return unserialize($v);
},
$datas
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Redis/Pager/KnpSubscriber.php
Expand Up @@ -2,8 +2,8 @@

namespace Spy\Timeline\Driver\Redis\Pager;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Knp\Component\Pager\Event\ItemsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class KnpSubscriber extends AbstractPager implements EventSubscriberInterface
{
Expand Down
10 changes: 5 additions & 5 deletions src/Driver/Redis/QueryExecutor.php
Expand Up @@ -2,16 +2,16 @@

namespace Spy\Timeline\Driver\Redis;

use Spy\Timeline\ResultBuilder\QueryExecutor\QueryExecutorInterface;
use Spy\Timeline\Driver\Redis\Pager\PagerToken;
use Spy\Timeline\Driver\Redis\Pager\AbstractPager;
use Spy\Timeline\Driver\Redis\Pager\PagerToken;
use Spy\Timeline\ResultBuilder\QueryExecutor\QueryExecutorInterface;

class QueryExecutor extends AbstractPager implements QueryExecutorInterface
{
/**
* @param mixed $query query
* @param int $page page
* @param int $maxPerPage maxPerPage
* @param mixed $query query
* @param int $page page
* @param int $maxPerPage maxPerPage
*
* @throws \Exception
* @return \Traversable
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Redis/TimelineManager.php
Expand Up @@ -2,12 +2,12 @@

namespace Spy\Timeline\Driver\Redis;

use Symfony\Component\OptionsResolver\OptionsResolver;
use Spy\Timeline\Driver\TimelineManagerInterface;
use Spy\Timeline\Model\ActionInterface;
use Spy\Timeline\Model\ComponentInterface;
use Spy\Timeline\Model\TimelineInterface;
use Spy\Timeline\ResultBuilder\ResultBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TimelineManager implements TimelineManagerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/DataHydrator.php
Expand Up @@ -2,8 +2,8 @@

namespace Spy\Timeline\Filter;

use Spy\Timeline\Filter\DataHydrator\Locator\LocatorInterface;
use Spy\Timeline\Filter\DataHydrator\Entry;
use Spy\Timeline\Filter\DataHydrator\Locator\LocatorInterface;
use Spy\Timeline\Model\TimelineInterface;
use Spy\Timeline\ResultBuilder\Pager\PagerInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/Filter/DataHydrator/Entry.php
Expand Up @@ -3,8 +3,8 @@
namespace Spy\Timeline\Filter\DataHydrator;

use Doctrine\Common\Persistence\Proxy;
use Spy\Timeline\Model\ActionInterface;
use Spy\Timeline\Model\ActionComponentInterface;
use Spy\Timeline\Model\ActionInterface;

class Entry
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/FilterManager.php
Expand Up @@ -48,7 +48,7 @@ public function filter($collection)
*/
protected function sortFilters()
{
usort($this->filters, function(FilterInterface $a, FilterInterface $b) {
usort($this->filters, function (FilterInterface $a, FilterInterface $b) {
$a = $a->getPriority();
$b = $b->getPriority();

Expand Down
6 changes: 3 additions & 3 deletions src/Model/ActionInterface.php
Expand Up @@ -4,9 +4,9 @@

interface ActionInterface
{
CONST STATUS_PENDING = 'pending';
CONST STATUS_PUBLISHED = 'published';
CONST STATUS_FROZEN = 'frozen';
const STATUS_PENDING = 'pending';
const STATUS_PUBLISHED = 'published';
const STATUS_FROZEN = 'frozen';

/**
* @param string $type type
Expand Down
10 changes: 5 additions & 5 deletions src/Model/TimelineInterface.php
Expand Up @@ -4,7 +4,7 @@

interface TimelineInterface
{
CONST TYPE_TIMELINE = 'timeline';
const TYPE_TIMELINE = 'timeline';

/**
* {@inheritdoc}
Expand All @@ -17,7 +17,7 @@ public function setId($id);
public function getId();

/**
* @param string $context
* @param string $context
* @return TimelineInterface
*/
public function setContext($context);
Expand All @@ -28,7 +28,7 @@ public function setContext($context);
public function getContext();

/**
* @param string $type
* @param string $type
* @return TimelineInterface
*/
public function setType($type);
Expand All @@ -39,7 +39,7 @@ public function setType($type);
public function getType();

/**
* @param \DateTime $createdAt
* @param \DateTime $createdAt
* @return TimelineInterface
*/
public function setCreatedAt(\DateTime $createdAt);
Expand All @@ -61,7 +61,7 @@ public function setSubject(ComponentInterface $subject);
public function getSubject();

/**
* @param ActionInterface $action
* @param ActionInterface $action
* @return TimelineInterface
*/
public function setAction(ActionInterface $action);
Expand Down
2 changes: 1 addition & 1 deletion src/ResolveComponent/BasicComponentDataResolver.php
Expand Up @@ -2,9 +2,9 @@

namespace Spy\Timeline\ResolveComponent;

use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;
use Spy\Timeline\Exception\ResolveComponentDataException;
use Spy\Timeline\ResolveComponent\ValueObject\ResolveComponentModelIdentifier;
use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;

/**
* Basic implementation of a component data resolver.
Expand Down
4 changes: 2 additions & 2 deletions src/ResolveComponent/ComponentDataResolverInterface.php
Expand Up @@ -2,9 +2,9 @@

namespace Spy\Timeline\ResolveComponent;

use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;
use Spy\Timeline\ResolveComponent\ValueObject\ResolveComponentModelIdentifier;
use Spy\Timeline\Exception\ResolveComponentDataException;
use Spy\Timeline\ResolveComponent\ValueObject\ResolveComponentModelIdentifier;
use Spy\Timeline\ResolveComponent\ValueObject\ResolvedComponentData;

interface ComponentDataResolverInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/ResolveComponent/ValueObject/ResolvedComponentData.php
Expand Up @@ -75,7 +75,7 @@ public function getData()
public function getIdentifier()
{
if (is_scalar($this->identifier)) {
return (string)$this->identifier;
return (string) $this->identifier;
}

return $this->identifier;
Expand Down
2 changes: 1 addition & 1 deletion src/ResultBuilder/Pager/KnpPager.php
Expand Up @@ -78,7 +78,7 @@ public function getNbResults()
}

/**
* @param array $items items
* @param array $items items
* @throws \Exception
*/
public function setItems(array $items)
Expand Down
6 changes: 3 additions & 3 deletions src/ResultBuilder/Pager/PagerInterface.php
Expand Up @@ -5,9 +5,9 @@
interface PagerInterface
{
/**
* @param mixed $target target
* @param int $page page
* @param int $limit limit
* @param mixed $target target
* @param int $page page
* @param int $limit limit
*
* @return mixed
*/
Expand Down
4 changes: 2 additions & 2 deletions src/ResultBuilder/ResultBuilder.php
Expand Up @@ -3,8 +3,8 @@
namespace Spy\Timeline\ResultBuilder;

use Spy\Timeline\Filter\FilterManagerInterface;
use Spy\Timeline\ResultBuilder\QueryExecutor\QueryExecutorInterface;
use Spy\Timeline\ResultBuilder\Pager\PagerInterface;
use Spy\Timeline\ResultBuilder\QueryExecutor\QueryExecutorInterface;

class ResultBuilder implements ResultBuilderInterface
{
Expand Down Expand Up @@ -38,7 +38,7 @@ public function setPager(PagerInterface $pager)
}

/**
* @param mixed $query target
* @param mixed $query target
* @param int $page page
* @param int $maxPerPage maxPerPage
* @param boolean $filter filter
Expand Down

0 comments on commit 5a38496

Please sign in to comment.