Skip to content

Commit a192709

Browse files
committed
Merge pull request #88 from GrahamForks/cs
More CS Fixes
2 parents 975cf33 + ac7df0d commit a192709

37 files changed

+1232
-747
lines changed

src/Parse/Internal/AddOperation.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
/**
99
* Class AddOperation - FieldOperation for adding object(s) to array fields.
1010
*
11-
* @author Fosco Marotto <[email protected]>
11+
* @author Fosco Marotto <[email protected]>
1212
*/
1313
class AddOperation implements FieldOperation
1414
{
1515
/**
16-
* @var - Array with objects to add.
16+
* Array with objects to add.
17+
*
18+
* @var array
1719
*/
1820
private $objects;
1921

src/Parse/Internal/AddUniqueOperation.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
/**
99
* Class AddUniqueOperation - Operation to add unique objects to an array key.
1010
*
11-
* @author Fosco Marotto <[email protected]>
11+
* @author Fosco Marotto <[email protected]>
1212
*/
1313
class AddUniqueOperation implements FieldOperation
1414
{
1515
/**
16-
* @var - Array containing objects to add.
16+
* Array containing objects to add.
17+
*
18+
* @var array
1719
*/
1820
private $objects;
1921

src/Parse/Internal/DeleteOperation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Class DeleteOperation - FieldOperation to remove a key from an object.
77
*
8-
* @author Fosco Marotto <[email protected]>
8+
* @author Fosco Marotto <[email protected]>
99
*/
1010
class DeleteOperation implements FieldOperation
1111
{

src/Parse/Internal/Encodable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Class Encodable - Interface for Parse Classes which provide an encode
77
* method.
88
*
9-
* @author Fosco Marotto <[email protected]>
9+
* @author Fosco Marotto <[email protected]>
1010
*/
1111
interface Encodable
1212
{

src/Parse/Internal/FieldOperation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Class FieldOperation - Interface for all Parse Field Operations.
77
*
8-
* @author Fosco Marotto <[email protected]>
8+
* @author Fosco Marotto <[email protected]>
99
*/
1010
interface FieldOperation extends Encodable
1111
{

src/Parse/Internal/IncrementOperation.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
/**
88
* Class IncrementOperation - Operation to increment numeric object key.
99
*
10-
* @author Fosco Marotto <[email protected]>
10+
* @author Fosco Marotto <[email protected]>
1111
*/
1212
class IncrementOperation implements FieldOperation
1313
{
1414
/**
15-
* @var int - Amount to increment by.
15+
* Amount to increment by.
16+
*
17+
* @var int
1618
*/
1719
private $value;
1820

src/Parse/Internal/ParseRelationOperation.php

+53-26
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,28 @@
99
/**
1010
* ParseRelationOperation - A class that is used to manage ParseRelation changes such as object add or remove.
1111
*
12-
* @author Mohamed Madbouli <[email protected]>
12+
* @author Mohamed Madbouli <[email protected]>
1313
*/
1414
class ParseRelationOperation implements FieldOperation
1515
{
1616
/**
17-
* @var string - The className of the target objects.
17+
* The className of the target objects.
18+
*
19+
* @var string
1820
*/
1921
private $targetClassName;
22+
2023
/**
21-
* @var array - Array of objects to add to this relation.
24+
* Array of objects to add to this relation.
25+
*
26+
* @var array
2227
*/
2328
private $relationsToAdd = [];
29+
2430
/**
25-
* @var array - Array of objects to remove from this relation.
31+
* Array of objects to remove from this relation.
32+
*
33+
* @var array
2634
*/
2735
private $relationsToRemove = [];
2836

@@ -126,10 +134,13 @@ public function _apply($oldValue, $object, $key)
126134
return new ParseRelation($object, $key, $this->targetClassName);
127135
} elseif ($oldValue instanceof ParseRelation) {
128136
if ($this->targetClassName != null
129-
&& $oldValue->getTargetClass() !== $this->targetClassName) {
130-
throw new \Exception('Related object object must be of class '
131-
.$this->targetClassName.', but '.$oldValue->getTargetClass()
132-
.' was passed in.');
137+
&& $oldValue->getTargetClass() !== $this->targetClassName
138+
) {
139+
throw new \Exception(
140+
'Related object object must be of class '
141+
.$this->targetClassName.', but '.$oldValue->getTargetClass()
142+
.' was passed in.'
143+
);
133144
}
134145

135146
return $oldValue;
@@ -155,34 +166,50 @@ public function _mergeWithPrevious($previous)
155166
}
156167
if ($previous instanceof ParseRelationOperation) {
157168
if ($previous->targetClassName != null
158-
&& $previous->targetClassName != $this->targetClassName
169+
&& $previous->targetClassName != $this->targetClassName
159170
) {
160-
throw new \Exception('Related object object must be of class '
161-
.$this->targetClassName.', but '.$previous->targetClassName
162-
.' was passed in.');
171+
throw new \Exception(
172+
'Related object object must be of class '
173+
.$this->targetClassName.', but '.$previous->targetClassName
174+
.' was passed in.'
175+
);
163176
}
164177
$newRelationToAdd = self::convertToOneDimensionalArray(
165-
$this->relationsToAdd);
178+
$this->relationsToAdd
179+
);
166180
$newRelationToRemove = self::convertToOneDimensionalArray(
167-
$this->relationsToRemove);
181+
$this->relationsToRemove
182+
);
168183

169-
$previous->addObjects($newRelationToAdd,
170-
$previous->relationsToAdd);
171-
$previous->removeObjects($newRelationToAdd,
172-
$previous->relationsToRemove);
184+
$previous->addObjects(
185+
$newRelationToAdd,
186+
$previous->relationsToAdd
187+
);
188+
$previous->removeObjects(
189+
$newRelationToAdd,
190+
$previous->relationsToRemove
191+
);
173192

174-
$previous->removeObjects($newRelationToRemove,
175-
$previous->relationsToAdd);
176-
$previous->addObjects($newRelationToRemove,
177-
$previous->relationsToRemove);
193+
$previous->removeObjects(
194+
$newRelationToRemove,
195+
$previous->relationsToAdd
196+
);
197+
$previous->addObjects(
198+
$newRelationToRemove,
199+
$previous->relationsToRemove
200+
);
178201

179202
$newRelationToAdd = self::convertToOneDimensionalArray(
180-
$previous->relationsToAdd);
203+
$previous->relationsToAdd
204+
);
181205
$newRelationToRemove = self::convertToOneDimensionalArray(
182-
$previous->relationsToRemove);
206+
$previous->relationsToRemove
207+
);
183208

184-
return new ParseRelationOperation($newRelationToAdd,
185-
$newRelationToRemove);
209+
return new ParseRelationOperation(
210+
$newRelationToAdd,
211+
$newRelationToRemove
212+
);
186213
}
187214
throw new \Exception('Operation is invalid after previous operation.');
188215
}

src/Parse/Internal/RemoveOperation.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
* Class RemoveOperation - FieldOperation for removing object(s) from array
1111
* fields.
1212
*
13-
* @author Fosco Marotto <[email protected]>
13+
* @author Fosco Marotto <[email protected]>
1414
*/
1515
class RemoveOperation implements FieldOperation
1616
{
1717
/**
18-
* @var - Array with objects to remove.
18+
* Array with objects to remove.
19+
*
20+
* @var array
1921
*/
2022
private $objects;
2123

@@ -109,7 +111,8 @@ public function _apply($oldValue, $obj, $key)
109111
if ($oldObject instanceof ParseObject) {
110112
if ($newObject instanceof ParseObject
111113
&& !$oldObject->isDirty()
112-
&& $oldObject->getObjectId() == $newObject->getObjectId()) {
114+
&& $oldObject->getObjectId() == $newObject->getObjectId()
115+
) {
113116
// found the object, won't add it.
114117
} else {
115118
$newValue[] = $oldObject;

src/Parse/Internal/SetOperation.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@
77
/**
88
* Class SetOperation - Operation to set a value for an object key.
99
*
10-
* @author Fosco Marotto <[email protected]>
10+
* @author Fosco Marotto <[email protected]>
1111
*/
1212
class SetOperation implements FieldOperation
1313
{
1414
/**
15-
* @var - Value to set for this operation.
15+
* Value to set for this operation.
16+
*
17+
* @var mixed
1618
*/
1719
private $value;
1820

1921
/**
20-
* @var - If the value should be forced as object.
22+
* If the value should be forced as object.
23+
*
24+
* @var bool
2125
*/
2226
private $isAssociativeArray;
2327

src/Parse/ParseACL.php

+19-20
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,39 @@
1212
* example, any user could read a particular object but only a particular set
1313
* of users could write to that object.
1414
*
15-
* @author Mohamed Madbouli <[email protected]>
15+
* @author Mohamed Madbouli <[email protected]>
1616
*/
1717
class ParseACL implements Encodable
1818
{
19-
/*
20-
* @ignore
21-
*/
2219
const PUBLIC_KEY = '*';
20+
2321
/**
24-
* @var array -
22+
* @var array
2523
*/
2624
private $permissionsById = [];
25+
2726
/**
28-
* @var bool -
27+
* @var bool
2928
*/
3029
private $shared = false;
30+
3131
/**
32-
* @var ParseUser -
32+
* @var ParseUser
3333
*/
3434
private static $lastCurrentUser = null;
35+
3536
/**
36-
* @var ParseACL -
37+
* @var ParseACL
3738
*/
3839
private static $defaultACLWithCurrentUser = null;
40+
3941
/**
40-
* @var ParseACL -
42+
* @var ParseACL
4143
*/
4244
private static $defaultACL = null;
45+
4346
/**
44-
* @var bool -
47+
* @var bool
4548
*/
4649
private static $defaultACLUsesCurrentUser = false;
4750

@@ -69,7 +72,6 @@ public static function createACLWithUser($user)
6972
* @throws \Exception
7073
*
7174
* @return ParseACL
72-
* @ignore
7375
*/
7476
public static function _createACLFromJSON($data)
7577
{
@@ -81,11 +83,13 @@ public static function _createACLFromJSON($data)
8183
foreach ($permissions as $accessType => $value) {
8284
if ($accessType !== 'read' && $accessType !== 'write') {
8385
throw new \Exception(
84-
'Tried to create an ACL with an invalid permission type.');
86+
'Tried to create an ACL with an invalid permission type.'
87+
);
8588
}
8689
if (!is_bool($value)) {
8790
throw new \Exception(
88-
'Tried to create an ACL with an invalid permission value.');
91+
'Tried to create an ACL with an invalid permission value.'
92+
);
8993
}
9094
$acl->setAccess($accessType, $id, $value);
9195
}
@@ -98,7 +102,6 @@ public static function _createACLFromJSON($data)
98102
* Return if ParseACL shared or not.
99103
*
100104
* @return bool
101-
* @ignore
102105
*/
103106
public function _isShared()
104107
{
@@ -109,16 +112,12 @@ public function _isShared()
109112
* Set shared for ParseACL.
110113
*
111114
* @param bool $shared
112-
* @ignore
113115
*/
114116
public function _setShared($shared)
115117
{
116118
$this->shared = $shared;
117119
}
118120

119-
/**
120-
* @ignore
121-
*/
122121
public function _encode()
123122
{
124123
if (empty($this->permissionsById)) {
@@ -438,7 +437,8 @@ private static function validateRoleState($role)
438437
{
439438
if (!$role->getObjectId()) {
440439
throw new \Exception(
441-
"Roles must be saved to the server before they can be used in an ACL.");
440+
"Roles must be saved to the server before they can be used in an ACL."
441+
);
442442
}
443443
}
444444

@@ -538,7 +538,6 @@ public static function setDefaultACL($acl, $withAccessForCurrentUser)
538538
* Get the defaultACL.
539539
*
540540
* @return ParseACL
541-
* @ignore
542541
*/
543542
public static function _getDefaultACL()
544543
{

src/Parse/ParseAggregateException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* ParseAggregateException - Multiple error condition.
77
*
8-
* @author Fosco Marotto <[email protected]>
8+
* @author Fosco Marotto <[email protected]>
99
*/
1010
class ParseAggregateException extends ParseException
1111
{

0 commit comments

Comments
 (0)