Skip to content

Commit

Permalink
more exceptions docblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmirazh33 committed Jan 8, 2016
1 parent e661259 commit aa7f8a8
Show file tree
Hide file tree
Showing 26 changed files with 86 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/AnalogueServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function boot()
*/
public function register()
{
$this->app->singleton('analogue', function($app) {
$this->app->singleton('analogue', function ($app) {

$db = $app['db'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class Command
/**
* Command constructor.
* @param Aggregate $aggregate
* @param QueryAdapter $query
* @param QueryAdapter|\Analogue\ORM\Drivers\IlluminateQueryAdapter $query
*/
public function __construct(Aggregate $aggregate, QueryAdapter $query)
{
Expand Down
4 changes: 4 additions & 0 deletions src/Commands/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Store extends Command
/**
* Persist the entity in the database
*
* @throws \InvalidArgumentException
* @return false|mixed
*/
public function execute()
Expand Down Expand Up @@ -69,6 +70,7 @@ public function execute()
* Run all operations that have to occur before actually
* storing the entity
*
* @throws \InvalidArgumentException
* @return void
*/
protected function preStoreProcess()
Expand All @@ -83,6 +85,7 @@ protected function preStoreProcess()
* Check for existence and create non-existing related entities
*
* @param array
* @throws \InvalidArgumentException
* @return void
*/
protected function createRelatedEntities($relations)
Expand Down Expand Up @@ -112,6 +115,7 @@ protected function createStoreCommand(Aggregate $aggregate)
* Run all operations that have to occur after the entity
* is stored.
*
* @throws \InvalidArgumentException
* @return void
*/
protected function postStoreProcess()
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/DBAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface DBAdapter
/**
* Return's Driver specific Query Implementation
*
* @return \Analogue\ORM\Drivers\QueryAdapter
* @return \Analogue\ORM\Drivers\QueryAdapter|\Analogue\ORM\Drivers\IlluminateQueryAdapter
*/
public function getQuery();

Expand Down
9 changes: 9 additions & 0 deletions src/EntityCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct(array $entities = null)
*
* @param mixed $key
* @param mixed $default
* @throws MappingException
* @return \Analogue\ORM\Entity
*/
public function find($key, $default = null)
Expand Down Expand Up @@ -63,6 +64,7 @@ public function add($entity)
* Remove an entity from the collection
*
* @param $entity
* @throws MappingException
* @return mixed
*/
public function remove($entity)
Expand Down Expand Up @@ -184,6 +186,7 @@ public function getSubsetByHashes(array $hashes)
* Merge the collection with the given items.
*
* @param array $items
* @throws MappingException
* @return self
*/
public function merge($items)
Expand Down Expand Up @@ -222,6 +225,7 @@ public function diff($items)
* Intersect the collection with the given items.
*
* @param \ArrayAccess|array $items
* @throws MappingException
* @return self
*/
public function intersect($items)
Expand Down Expand Up @@ -269,6 +273,7 @@ public function except($keys)
* Get a dictionary keyed by primary keys.
*
* @param \ArrayAccess|array $items
* @throws MappingException
* @return array
*/
public function getDictionary($items = null)
Expand All @@ -285,6 +290,7 @@ public function getDictionary($items = null)
}

/**
* @throws MappingException
* @return array
*/
public function getEntityKeys()
Expand All @@ -310,6 +316,7 @@ protected function getEntityKey($entity)
* Get the max value of a given key.
*
* @param string|null $key
* @throws MappingException
* @return mixed
*/
public function max($key = null)
Expand All @@ -326,6 +333,7 @@ public function max($key = null)
* Get the min value of a given key.
*
* @param string|null $key
* @throws MappingException
* @return mixed
*/
public function min($key = null)
Expand Down Expand Up @@ -366,6 +374,7 @@ public function lists($value, $key = null)
* Return only unique items from the collection.
*
* @param string|null $key
* @throws MappingException
* @return self
*/
public function unique($key = null)
Expand Down
5 changes: 1 addition & 4 deletions src/EntityMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -929,10 +929,7 @@ public function morphToMany($entity, $related, $name, $table = null, $foreignKey

$table = $table ?: str_plural($name);

return new MorphToMany(
$relatedMapper, $entity, $name, $table, $foreignKey,
$otherKey, $caller, $inverse
);
return new MorphToMany($relatedMapper, $entity, $name, $table, $foreignKey, $otherKey, $caller, $inverse);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Plugins/AnaloguePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ abstract class AnaloguePlugin implements AnaloguePluginInterface
*/
protected $manager;

/**
* AnaloguePlugin constructor.
* @param Manager $manager
*/
public function __construct(Manager $manager)
{
$this->manager = $manager;
Expand Down
2 changes: 2 additions & 0 deletions src/Plugins/SoftDeletes/SoftDeletesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SoftDeletesPlugin extends AnaloguePlugin
/**
* Register the plugin
*
* @throws \Exception
* @return void
*/
public function register()
Expand All @@ -38,6 +39,7 @@ public function register()
* with the softDelete capacity.
*
* @param \Analogue\ORM\System\Mapper $mapper
* @throws \Analogue\ORM\Exceptions\MappingException
* @return bool|void
*/
protected function registerSoftDelete(Mapper $mapper)
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/SoftDeletes/SoftDeletingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function apply(Query $query)
/**
* Remove the scope from the given Analogue query builder.
*
* @param \Analogue\ORM\System\Query $query
* @param mixed $query
* @return void
*/
public function remove(Query $query)
Expand Down
1 change: 1 addition & 0 deletions src/Plugins/Timestamps/TimestampsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class TimestampsPlugin extends AnaloguePlugin
/**
* Register the plugin
*
* @throws \Exception
* @return void
*/
public function register()
Expand Down
3 changes: 2 additions & 1 deletion src/Relationships/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function __construct(Mapper $mapper, $parent, $foreignKey, $otherKey, $re
}

/**
* @param $related
* @param $related
* @return mixed
*/
public function attachTo($related)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Relationships/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
use Analogue\ORM\System\InternallyMappable;
use Analogue\ORM\Exceptions\EntityNotFoundException;

/**
* @method where
* @method take
*/
class BelongsToMany extends Relationship
{
/**
Expand Down Expand Up @@ -79,14 +75,16 @@ public function __construct(Mapper $mapper, $parent, $table, $foreignKey, $other
}

/**
* @param $related
* @param $related
* @return mixed
*/
public function attachTo($related)
{
}

/**
* @param $related
* @param $related
* @return mixed
*/
public function detachFrom($related)
{
Expand Down Expand Up @@ -574,6 +572,7 @@ public function createPivots($relatedEntities)
*
* @param mixed $id
* @param array $attributes
* @throws \InvalidArgumentException
* @return integer
*/
public function updateExistingPivot($id, array $attributes)
Expand Down Expand Up @@ -762,6 +761,7 @@ protected function getModelKeysFromCollection(EntityCollection $entities)
* Detach models from the relationship.
*
* @param int|array $ids
* @throws \InvalidArgumentException
* @return int
*/
public function detach($ids = [])
Expand Down Expand Up @@ -790,7 +790,7 @@ public function detach($ids = [])
/**
* Create a new query builder for the pivot table.
*
* @throws \InvalidArgumentException
* @throws \InvalidArgumentException
*
* @return \Illuminate\Database\Query\Builder
*/
Expand Down
3 changes: 3 additions & 0 deletions src/Relationships/HasManyThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class HasManyThrough extends Relationship
* @param \Analogue\ORM\EntityMap $parentMap
* @param string $firstKey
* @param string $secondKey
* @throws \Analogue\ORM\Exceptions\MappingException
*/
public function __construct(Mapper $mapper, $farParent, $parentMap, $firstKey, $secondKey)
{
Expand All @@ -61,6 +62,7 @@ public function __construct(Mapper $mapper, $farParent, $parentMap, $firstKey, $

/**
* @param $related
* @return mixed
*/
public function attachTo($related)
{
Expand All @@ -69,6 +71,7 @@ public function attachTo($related)

/**
* @param $related
* @return mixed
*/
public function detachFrom($related)
{
Expand Down
5 changes: 4 additions & 1 deletion src/Relationships/HasOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct(Mapper $mapper, $parentEntity, $foreignKey, $localKe

/**
* @param \Analogue\ORM\Entity|EntityCollection $entity
* @return void
*/
public function attachTo($entity)
{
Expand Down Expand Up @@ -96,6 +97,7 @@ protected function detachOne($entityHash)
/**
* Attach ids that are passed as arguments, and detach any other
* @param mixed $entities
* @throws \InvalidArgumentException
* @return void
*/
public function sync(array $entities)
Expand All @@ -104,7 +106,8 @@ public function sync(array $entities)
}

/**
* @param $entities
* @param $entities
* @throws \InvalidArgumentException
*/
protected function detachExcept($entities)
{
Expand Down
11 changes: 6 additions & 5 deletions src/Relationships/MorphOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ abstract class MorphOneOrMany extends HasOneOrMany
/**
* Create a new has many relationship instance.
*
* @param Mapper $mapper
* @param \Analogue\ORM\Mappable $parent
* @param string $type
* @param string $id
* @param string $localKey
* @param Mapper $mapper
* @param \Analogue\ORM\Mappable $parent
* @param string $type
* @param string $id
* @param string $localKey
* @throws \Analogue\ORM\Exceptions\MappingException
*/
public function __construct(Mapper $mapper, $parent, $type, $id, $localKey)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Relationships/MorphTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function match(array $entities, EntityCollection $results, $relation)
/**
* Get the results of the relationship.
*
* @throws \Analogue\ORM\Exceptions\MappingException
* @return EntityCollection
*/
public function getEager()
Expand Down Expand Up @@ -135,6 +136,7 @@ protected function matchToMorphParents($type, EntityCollection $results)
* Get all of the relation results for a type.
*
* @param string $type
* @throws \Analogue\ORM\Exceptions\MappingException
* @return EntityCollection
*/
protected function getResultsByType($type)
Expand Down
5 changes: 3 additions & 2 deletions src/Relationships/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ abstract class Relationship
/**
* Create a new relation instance.
*
* @param Mapper $mapper
* @param Mappable $parent
* @param Mapper $mapper
* @param Mappable $parent
* @throws \Analogue\ORM\Exceptions\MappingException
*/
public function __construct(Mapper $mapper, $parent)
{
Expand Down
4 changes: 4 additions & 0 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public function paginate($perPage = null)
* Delete an entity or an entity collection from the database
*
* @param Mappable|EntityCollection $entity
* @throws MappingException
* @throws \InvalidArgumentException
* @return \Illuminate\Support\Collection|null
*/
public function delete($entity)
Expand All @@ -113,6 +115,8 @@ public function delete($entity)
* Persist an entity or an entity collection in the database.
*
* @param Mappable|EntityCollection|array $entity
* @throws MappingException
* @throws \InvalidArgumentException
* @return Mappable|EntityCollection|array
*/
public function store($entity)
Expand Down
6 changes: 5 additions & 1 deletion src/System/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Aggregate implements InternallyMappable
* @param Aggregate|null $parent
* @param string $parentRelationship
* @param Aggregate|null $root
* @throws MappingException
*/
public function __construct($entity, Aggregate $parent = null, $parentRelationship = null, Aggregate $root = null)
{
Expand All @@ -102,6 +103,7 @@ public function __construct($entity, Aggregate $parent = null, $parentRelationsh
/**
* Parse Every relationships defined on the entity
*
* @throws MappingException
* @return void
*/
protected function parseRelationships()
Expand Down Expand Up @@ -295,7 +297,8 @@ protected function createSubAggregates($entities, $relation)
* Create a related subAggregate
*
* @param mixed $entity
* @param string $relation
* @param string $relation
* @throws MappingException
* @return self
*/
protected function createSubAggregate($entity, $relation)
Expand Down Expand Up @@ -577,6 +580,7 @@ protected function flattenEmbeddables($attributes)
* Return's entity raw attributes in the state they were at last
* query.
*
* @param array|null $columns
* @return array
*/
protected function getCachedRawAttributes(array $columns = null)
Expand Down
Loading

0 comments on commit aa7f8a8

Please sign in to comment.