Skip to content

Commit 725944b

Browse files
committed
Merge pull request #37 from cordoval/more-work-on-lib
typos and improvements
2 parents 0ee882b + 5e0b512 commit 725944b

File tree

12 files changed

+48
-44
lines changed

12 files changed

+48
-44
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ matrix:
1111
allow_failures:
1212
- php: hhvm
1313

14-
install: composer install
14+
install: composer install -n
1515

1616
script:
1717
- bin/atoum -d tests/units

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ At this moment, only one driver is **redis**, use `Symfony2` and `Bundle <https:
1111
Description
1212
-----------
1313

14-
A timeline is a collection of action which can be represented by:
14+
A timeline is a collection of actions which can be represented by:
1515

1616
- **Subject**
1717
- **Verb**
@@ -22,22 +22,22 @@ Example:
2222
+--------------+---------+--------------------------------------------------------------------+
2323
| Subject | Verb | Complements |
2424
+==============+=========+====================================================================+
25-
| Chuck Norris | Own | the world (directComplement), with Vic Mc Key (indirectComplement) |
25+
| Chuck Norris | own | the world (directComplement), with Vic Mc Key (indirectComplement) |
2626
+--------------+---------+--------------------------------------------------------------------+
2727
| Sheldon | say | Bazinga (directComplement) |
2828
+--------------+---------+--------------------------------------------------------------------+
2929

30-
There is two types of action list to retrieve:
30+
There are two types of action lists to retrieve:
3131

3232
Timeline
3333
~~~~~~~~
3434

35-
Wall of a subject with all its actions + all actions of its **spreads**, see `spread.rst <https://github.com/stephpy/timeline/tree/master/doc/spread.rst>`_
35+
Stream of actions where the subject is involved + all actions of its **spreads**, see `spread.rst <https://github.com/stephpy/timeline/tree/master/doc/spread.rst>`_
3636

3737
SubjectAction
3838
~~~~~~~~~~~~~
3939

40-
All actions of the subject.
40+
All actions the subject performed.
4141

4242
Context
4343
~~~~~~~
@@ -46,7 +46,7 @@ Imagine Chuck Norris has 233 friends and follow 20 companies.
4646

4747
If we have one context, like facebook, his wall will return each action performed by his friends and companies.
4848

49-
You can too use **Contexts** to filter timelines, for example, we can have 3 contexts:
49+
You can also use **Contexts** to filter timelines, for example, we can have 3 contexts:
5050

5151
- GLOBAL: actions of his friends and companies
5252
- FRIEND: actions of his friends

example/basic.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,34 @@
1616
// Push an action
1717

1818
$actionManager = $c['action_manager'];
19-
$chuck = $actionManager->findOrCreateComponent('User', 'Chuck');
20-
$bruceLee = $actionManager->findOrCreateComponent('User', 'BruceLee');
19+
$chuck = $actionManager->findOrCreateComponent('User', 'Chuck');
20+
$bruceLee = $actionManager->findOrCreateComponent('User', 'BruceLee');
2121

2222
$action = $actionManager->create($chuck, 'kick', array('directComplement' => $bruceLee));
2323
$actionManager->updateAction($action);
2424

2525
// Pull a timeline of a subject
2626

27-
$actionManager = $c['action_manager'];
27+
$actionManager = $c['action_manager'];
2828
$timelineManager = $c['timeline_manager'];
29-
$chuck = $actionManager->findOrCreateComponent('User', 'Chuck');
29+
$chuck = $actionManager->findOrCreateComponent('User', 'Chuck');
3030

31-
$timeline = $timelineManager->getTimeline($chuck);
31+
$timeline = $timelineManager->getTimeline($chuck);
3232

3333
print sprintf("---- Timeline Results = (%s) -----\n", count($timeline));
3434

3535
foreach ($timeline as $action) {
36-
$subject = $action->getSubject();
36+
$subject = $action->getSubject();
3737
$directComplement = $action->getComponent('directComplement');
3838
//.....
3939
}
4040

4141
// Pull actions of a subject
4242

4343
$actionManager = $c['action_manager'];
44-
$chuck = $actionManager->findOrCreateComponent('User', 'Chuck');
44+
$chuck = $actionManager->findOrCreateComponent('User', 'Chuck');
4545

46-
$actions = $actionManager->getSubjectActions($chuck);
46+
$actions = $actionManager->getSubjectActions($chuck);
4747

4848
print sprintf("---- Actions Results = (%s) -----\n", count($actions));
4949

src/Driver/AbstractActionManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function create($subject, $verb, array $components = array())
7474
* @param ActionInterface $action action
7575
* @param string $type type
7676
* @param mixed $component component
77+
* @throws \Exception
7778
*/
7879
public function addComponent($action, $type, $component)
7980
{

src/Driver/QueryBuilder/Criteria/Asserter.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class Asserter implements CriteriaInterface
1212
CONST ASSERTER_NOT_LIKE = 'NOT LIKE';
1313
CONST ASSERTER_LOWER_THAN = '<';
1414
CONST ASSERTER_LOWER_THAN_EQUAL = '<=';
15-
CONST ASSERTER_GREATHER_THAN = '>';
16-
CONST ASSERTER_GREATHER_THAN_EQUAL = '>=';
15+
CONST ASSERTER_GREATER_THAN = '>';
16+
CONST ASSERTER_GREATER_THAN_EQUAL = '>=';
1717

1818
/**
1919
* @var string
@@ -109,27 +109,27 @@ public function lte($value)
109109
}
110110

111111
/**
112-
* greather than
112+
* greater than
113113
*
114114
* @param mixed $value value
115115
*
116-
* @return return DateTimeAsserter
116+
* @return Asserter
117117
*/
118118
public function gt($value)
119119
{
120-
return $this->create(self::ASSERTER_GREATHER_THAN, $this->transform($value));
120+
return $this->create(self::ASSERTER_GREATER_THAN, $this->transform($value));
121121
}
122122

123123
/**
124-
* greather than equal
124+
* greater than equal
125125
*
126126
* @param mixed $value value
127127
*
128-
* @return return DateTimeAsserter
128+
* @return Asserter
129129
*/
130130
public function gte($value)
131131
{
132-
return $this->create(self::ASSERTER_GREATHER_THAN_EQUAL, $this->transform($value));
132+
return $this->create(self::ASSERTER_GREATER_THAN_EQUAL, $this->transform($value));
133133
}
134134

135135

@@ -170,7 +170,8 @@ public function fromArray(array $data)
170170
list ($field, $operator, $value) = $data['value'];
171171

172172
return $this->field($field)
173-
->create($operator, $value);
173+
->create($operator, $value)
174+
;
174175
}
175176

176177
/**

src/Driver/QueryBuilder/Criteria/Operator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Operator implements CriteriaInterface
1515
protected $type;
1616

1717
/**
18-
* @var array<CriteriaInterface>
18+
* @var CriteriaInterface[]
1919
*/
2020
protected $criterias = array();
2121

@@ -77,7 +77,7 @@ public function getType()
7777
}
7878

7979
/**
80-
* @return array<CriteriaInterface>
80+
* @return CriteriaInterface[]
8181
*/
8282
public function getCriterias()
8383
{

src/Driver/QueryBuilder/QueryBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ public function createNewOperator($type, array $args)
111111
return $this->factory
112112
->createOperator()
113113
->setType($type)
114-
->setCriterias($args);
114+
->setCriterias($args)
115+
;
115116
}
116117

117118
/**

src/Driver/QueryBuilder/QueryBuilderFactory.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ public function createOperator()
6666
*/
6767
public function createOperatorFromArray(array $data)
6868
{
69-
return $this->createOperator()
70-
->fromArray($data, $this)
71-
;
69+
return $this->createOperator()->fromArray($data, $this);
7270
}
7371

7472
/**
@@ -86,8 +84,6 @@ public function createAsserter()
8684
*/
8785
public function createAsserterFromArray(array $data)
8886
{
89-
return $this->createAsserter()
90-
->fromArray($data)
91-
;
87+
return $this->createAsserter()->fromArray($data);
9288
}
9389
}

src/Driver/Redis/Pager/AbstractPager.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ public function findActionsForIds(array $ids)
3737

3838
$datas = $this->client->hmget($this->getActionKey(), $ids);
3939

40-
return array_values(array_map(function($v) {
41-
return unserialize($v);
42-
}, $datas));
40+
return array_values(
41+
array_map(
42+
function($v) {
43+
return unserialize($v);
44+
},
45+
$datas
46+
)
47+
);
4348
}
4449

4550
/**

src/Driver/Redis/Pager/KnpSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public function items(ItemsEvent $event)
1818

1919
$target = $event->target;
2020
$offset = $event->getOffset();
21-
$limit = $event->getLimit() - 1;
21+
$limit = $event->getLimit() - 1;
2222

23-
$ids = $this->client->zRevRange($target->key, $offset, ($offset + $limit));
23+
$ids = $this->client->zRevRange($target->key, $offset, ($offset + $limit));
2424

2525
$event->count = $this->client->zCard($target->key);
2626
$event->items = $this->actionManager->findActionsForIds($ids);

0 commit comments

Comments
 (0)