Skip to content

Commit 06e598a

Browse files
Fix Docblocks in Model class and Embeds classes, and remove some unused arguments.
1 parent 00d3b8b commit 06e598a

File tree

4 files changed

+43
-39
lines changed

4 files changed

+43
-39
lines changed

src/Jenssegers/Mongodb/Model.php

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php namespace Jenssegers\Mongodb;
22

3+
use Carbon\Carbon;
34
use DateTime;
4-
use MongoId;
55
use MongoDate;
6-
use Carbon\Carbon;
7-
use ReflectionMethod;
6+
use MongoId;
87
use Illuminate\Database\Eloquent\Relations\Relation;
98
use Jenssegers\Mongodb\Eloquent\Builder;
10-
use Jenssegers\Mongodb\Relations\EmbedsOneOrMany;
119
use Jenssegers\Mongodb\Relations\EmbedsMany;
1210
use Jenssegers\Mongodb\Relations\EmbedsOne;
11+
use Jenssegers\Mongodb\Relations\EmbedsOneOrMany;
12+
use ReflectionMethod;
1313

1414
abstract class Model extends \Jenssegers\Eloquent\Model {
1515

@@ -37,8 +37,7 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
3737
/**
3838
* Custom accessor for the model's id.
3939
*
40-
* @param mixed $value
41-
*
40+
* @param mixed $value
4241
* @return mixed
4342
*/
4443
public function getIdAttribute($value)
@@ -73,8 +72,10 @@ public function getQualifiedKeyName()
7372
* Define an embedded one-to-many relationship.
7473
*
7574
* @param string $related
76-
* @param string $collection
77-
* @return \Illuminate\Database\Eloquent\Relations\EmbedsMany
75+
* @param string $localKey
76+
* @param string $foreignKey
77+
* @param string $relation
78+
* @return EmbedsMany
7879
*/
7980
protected function embedsMany($related, $localKey = null, $foreignKey = null, $relation = null)
8081
{
@@ -109,8 +110,10 @@ protected function embedsMany($related, $localKey = null, $foreignKey = null, $r
109110
* Define an embedded one-to-many relationship.
110111
*
111112
* @param string $related
112-
* @param string $collection
113-
* @return \Illuminate\Database\Eloquent\Relations\EmbedsMany
113+
* @param string $localKey
114+
* @param string $foreignKey
115+
* @param string $relation
116+
* @return \Jenssegers\Mongodb\Relations\EmbedsOne
114117
*/
115118
protected function embedsOne($related, $localKey = null, $foreignKey = null, $relation = null)
116119
{
@@ -311,7 +314,7 @@ public function setAttribute($key, $value)
311314

312315
array_set($this->attributes, $key, $value);
313316

314-
return;
317+
return;
315318
}
316319

317320
parent::setAttribute($key, $value);
@@ -353,7 +356,7 @@ public function attributesToArray()
353356
/**
354357
* Remove one or more fields.
355358
*
356-
* @param mixed $columns
359+
* @param mixed $columns
357360
* @return int
358361
*/
359362
public function drop($columns)
@@ -406,6 +409,8 @@ public function push()
406409
/**
407410
* Remove one or more values from an array.
408411
*
412+
* @param string $column
413+
* @param mixed $values
409414
* @return mixed
410415
*/
411416
public function pull($column, $values)
@@ -446,7 +451,7 @@ protected function pushAttributeValues($column, array $values, $unique = false)
446451
}
447452

448453
/**
449-
* Rempove one or more values to the underlying attribute value and sync with original.
454+
* Remove one or more values to the underlying attribute value and sync with original.
450455
*
451456
* @param string $column
452457
* @param array $values
@@ -474,7 +479,7 @@ protected function pullAttributeValues($column, array $values)
474479
/**
475480
* Set the parent relation.
476481
*
477-
* @param Relation $relation
482+
* @param \Illuminate\Database\Eloquent\Relations\Relation $relation
478483
*/
479484
public function setParentRelation(Relation $relation)
480485
{
@@ -484,7 +489,7 @@ public function setParentRelation(Relation $relation)
484489
/**
485490
* Get the parent relation.
486491
*
487-
* @return Relation
492+
* @return \Illuminate\Database\Eloquent\Relations\Relation
488493
*/
489494
public function getParentRelation()
490495
{

src/Jenssegers/Mongodb/Relations/EmbedsMany.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php namespace Jenssegers\Mongodb\Relations;
22

3-
use MongoId;
43
use Illuminate\Database\Eloquent\Model;
5-
use Illuminate\Pagination\Paginator;
64
use Illuminate\Pagination\LengthAwarePaginator;
5+
use Illuminate\Pagination\Paginator;
6+
use MongoId;
77

88
class EmbedsMany extends EmbedsOneOrMany {
99

1010
/**
1111
* Get the results of the relationship.
1212
*
13-
* @return Jenssegers\Mongodb\Eloquent\Collection
13+
* @return \Jenssegers\Mongodb\Eloquent\Collection
1414
*/
1515
public function getResults()
1616
{
@@ -20,10 +20,10 @@ public function getResults()
2020
/**
2121
* Save a new model and attach it to the parent model.
2222
*
23-
* @param \Illuminate\Database\Eloquent\Model $model
23+
* @param \Illuminate\Database\Eloquent\Model $model
2424
* @return \Illuminate\Database\Eloquent\Model
2525
*/
26-
public function performInsert(Model $model, array $values)
26+
public function performInsert(Model $model)
2727
{
2828
// Generate a new key if needed.
2929
if ($model->getKeyName() == '_id' and ! $model->getKey())
@@ -54,7 +54,7 @@ public function performInsert(Model $model, array $values)
5454
* @param \Illuminate\Database\Eloquent\Model $model
5555
* @return Model|bool
5656
*/
57-
public function performUpdate(Model $model, array $values)
57+
public function performUpdate(Model $model)
5858
{
5959
// For deeply nested documents, let the parent handle the changes.
6060
if ($this->isNested())
@@ -269,11 +269,10 @@ protected function associateExisting($model)
269269
/**
270270
* Get a paginator for the "select" statement.
271271
*
272-
* @param int $perPage
273-
* @param array $columns
272+
* @param int $perPage
274273
* @return \Illuminate\Pagination\Paginator
275274
*/
276-
public function paginate($perPage = null, $columns = array('*'))
275+
public function paginate($perPage = null)
277276
{
278277
$page = Paginator::resolveCurrentPage();
279278
$perPage = $perPage ?: $this->related->getPerPage();
@@ -303,7 +302,7 @@ protected function getEmbedded()
303302
/**
304303
* Set the embedded records array.
305304
*
306-
* @param array $models
305+
* @param array $models
307306
* @return void
308307
*/
309308
protected function setEmbedded($models)

src/Jenssegers/Mongodb/Relations/EmbedsOne.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php namespace Jenssegers\Mongodb\Relations;
22

3-
use MongoId;
43
use Illuminate\Database\Eloquent\Model;
4+
use MongoId;
55

66
class EmbedsOne extends EmbedsOneOrMany {
77

@@ -21,7 +21,7 @@ public function getResults()
2121
* @param \Illuminate\Database\Eloquent\Model $model
2222
* @return \Illuminate\Database\Eloquent\Model
2323
*/
24-
public function performInsert(Model $model, array $values)
24+
public function performInsert(Model $model)
2525
{
2626
// Generate a new key if needed.
2727
if ($model->getKeyName() == '_id' and ! $model->getKey())
@@ -49,9 +49,9 @@ public function performInsert(Model $model, array $values)
4949
* Save an existing model and attach it to the parent model.
5050
*
5151
* @param \Illuminate\Database\Eloquent\Model $model
52-
* @return Model|bool
52+
* @return \Illuminate\Database\Eloquent\Model|bool
5353
*/
54-
public function performUpdate(Model $model, array $values)
54+
public function performUpdate(Model $model)
5555
{
5656
if ($this->isNested())
5757
{
@@ -74,7 +74,7 @@ public function performUpdate(Model $model, array $values)
7474
/**
7575
* Delete an existing model and detach it from the parent model.
7676
*
77-
* @param Model $model
77+
* @param \Illuminate\Database\Eloquent\Model $model
7878
* @return int
7979
*/
8080
public function performDelete(Model $model)

src/Jenssegers/Mongodb/Relations/EmbedsOneOrMany.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php namespace Jenssegers\Mongodb\Relations;
22

3-
use MongoId;
4-
use Illuminate\Database\Eloquent\Model;
53
use Illuminate\Database\Eloquent\Builder;
6-
use Illuminate\Database\Eloquent\Relations\Relation;
74
use Illuminate\Database\Eloquent\Collection as BaseCollection;
5+
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Database\Eloquent\Relations\Relation;
87
use Jenssegers\Mongodb\Eloquent\Collection;
98

109
abstract class EmbedsOneOrMany extends Relation {
@@ -35,10 +34,10 @@ abstract class EmbedsOneOrMany extends Relation {
3534
*
3635
* @param \Illuminate\Database\Eloquent\Builder $query
3736
* @param \Illuminate\Database\Eloquent\Model $parent
37+
* @param \Illuminate\Database\Eloquent\Model $related
3838
* @param string $localKey
3939
* @param string $foreignKey
4040
* @param string $relation
41-
* @return void
4241
*/
4342
public function __construct(Builder $query, Model $parent, Model $related, $localKey, $foreignKey, $relation)
4443
{
@@ -126,7 +125,7 @@ public function match(array $models, BaseCollection $results, $relation)
126125
/**
127126
* Shorthand to get the results of the relationship.
128127
*
129-
* @return Jenssegers\Mongodb\Eloquent\Collection
128+
* @return \Jenssegers\Mongodb\Eloquent\Collection
130129
*/
131130
public function get()
132131
{
@@ -241,7 +240,7 @@ protected function getEmbedded()
241240
/**
242241
* Set the embedded records array.
243242
*
244-
* @param array $records
243+
* @param array $records
245244
* @return \Illuminate\Database\Eloquent\Model
246245
*/
247246
protected function setEmbedded($records)
@@ -260,7 +259,7 @@ protected function setEmbedded($records)
260259
/**
261260
* Get the foreign key value for the relation.
262261
*
263-
* @param mixed $id
262+
* @param mixed $id
264263
* @return mixed
265264
*/
266265
protected function getForeignKeyValue($id)
@@ -278,7 +277,7 @@ protected function getForeignKeyValue($id)
278277
* Convert an array of records to a Collection.
279278
*
280279
* @param array $records
281-
* @return Jenssegers\Mongodb\Eloquent\Collection
280+
* @return \Jenssegers\Mongodb\Eloquent\Collection
282281
*/
283282
protected function toCollection(array $records = array())
284283
{
@@ -322,7 +321,7 @@ protected function toModel($attributes = array())
322321
/**
323322
* Get the relation instance of the parent.
324323
*
325-
* @return Illuminate\Database\Eloquent\Relations\Relation
324+
* @return \Illuminate\Database\Eloquent\Relations\Relation
326325
*/
327326
protected function getParentRelation()
328327
{
@@ -366,6 +365,7 @@ protected function isNested()
366365
/**
367366
* Get the fully qualified local key name.
368367
*
368+
* @param string $glue
369369
* @return string
370370
*/
371371
protected function getPathHierarchy($glue = '.')

0 commit comments

Comments
 (0)