Skip to content

Commit

Permalink
move doc from connector manager/repository to interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie-Lucas committed Jan 12, 2016
1 parent 0ff3ff3 commit 04ee3ff
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public function __construct(ClientInterface $redis, ViewReferenceRedisRepository
}

/**
* This method create a viewReference in redis with an array of data.
*
* @param array $data
*
* @throws \Exception
* @inheritdoc
*/
public function create(array $data)
{
Expand All @@ -57,12 +53,7 @@ public function create(array $data)
}

/**
* This method update a viewReference with data.
*
* @param $id
* @param array $data
*
* @throws \Exception
* @inheritdoc
*/
public function update($id, array $data)
{
Expand All @@ -82,9 +73,7 @@ public function update($id, array $data)
}

/**
* This method remove a reference.
*
* @param $id
* @inheritdoc
*/
public function remove($id)
{
Expand Down Expand Up @@ -115,10 +104,7 @@ public function index($id, $values)
}

/**
* This method add a child to a reference.
*
* @param $parentId
* @param $childId
* @inheritdoc
*/
public function addChild($parentId, $childId)
{
Expand All @@ -133,9 +119,7 @@ public function addChild($parentId, $childId)
}

/**
* This method build an url for a viewReference with parent in redis.
*
* @param ViewReference $viewReference
* @inheritdoc
*/
public function buildUrl($id)
{
Expand All @@ -161,11 +145,7 @@ public function buildUrl($id)
}

/**
* This method set an url for a redis reference.
*
* @param $refId
* @param $url
* @param string $locale
* @inheritdoc
*/
public function setUrl($refId, $url, $locale = 'fr')
{
Expand All @@ -184,10 +164,7 @@ public function setUrl($refId, $url, $locale = 'fr')
}

/**
* Remove an url.
*
* @param $url
* @param $locale
* @inheritdoc
*/
public function removeUrl($url, $locale)
{
Expand All @@ -198,7 +175,7 @@ public function removeUrl($url, $locale)
}

/**
* This method clear redis.
* @inheritdoc
*/
public function reset()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,15 @@ public function __construct(ClientInterface $redis)
}

/**
* This method return all references.
*
* @return array
* @inheritdoc
*/
public function getAll()
{
return $this->redis->keys($this->alias.'*');
}

/**
* This method return all references matching with criteria
* Support "AND" and "OR".
*
* @param array $criteria
* @param string $type
*
* @return array
* @inheritdoc
*/
public function getAllBy(array $criteria, $type = 'AND')
{
Expand All @@ -61,11 +53,7 @@ public function getAllBy(array $criteria, $type = 'AND')
}

/**
* This method return an array of references matching with an array of id.
*
* @param array $data
*
* @return array
* @inheritdoc
*/
public function getResults(array $data)
{
Expand All @@ -76,26 +64,13 @@ public function getResults(array $data)

return $results;
}

/**
* This method return a reference matching with a ref id.
*
* @param $id
*
* @return array
*/
public function findById($id)
{
return $this->tools->unredislizeArray($this->redis->hgetall($this->alias.':'.$id));
}

/**
* This method return a specific value for an id or null if not exist.
*
* @param $value
* @param $id
*
* @return mixed|null|string
* @inheritdoc
*/
public function findValueForId($value, $id)
{
Expand All @@ -108,11 +83,7 @@ public function findValueForId($value, $id)
}

/**
* getChildren ids for a ref id.
*
* @param $id
*
* @return array
* @inheritdoc
*/
public function getChildren($id)
{
Expand All @@ -132,12 +103,7 @@ public function setAlias($alias)
}

/**
* Find a ref id for an url.
*
* @param string $url
* @param string $locale
*
* @return mixed|string
* @inheritdoc
*/
public function findRefIdByUrl($url = '', $locale = 'fr')
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,63 @@

interface ViewReferenceConnectorManagerInterface
{

/**
* This method create a viewReference in redis with an array of data.
*
* @param array $data
*/
public function create(array $data);

/**
* This method update a viewReference with data.
*
* @param $id
* @param array $data
*/
public function update($id, array $data);

/**
* This method remove a reference.
*
* @param $id
*/
public function remove($id);

public function index($id, $values);

/**
* This method add a child to a reference.
*
* @param $parentId
* @param $childId
*/
public function addChild($parentId, $childId);

/**
* This method build an url for a viewReference with parent in redis.
*
* @param $id
*/
public function buildUrl($id);

/**
* This method set an url for a redis reference.
*
* @param $refId
* @param $url
* @param string $locale
*/
public function setUrl($refId, $url, $locale = 'fr');

/**
* Remove an url.
*
* @param $url
* @param $locale
*/
public function removeUrl($url, $locale);

/**
* This method clear redis.
*/
public function reset();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,69 @@

interface ViewReferenceConnectorRepositoryInterface
{
/**
* This method return all references.
*
* @return array
*/
public function getAll();

/**
* This method return all references matching with criteria
* Support "AND" and "OR".
*
* @param array $criteria
* @param string $type
*
* @return array
*/
public function getAllBy(array $criteria, $type = 'AND');

/**
* This method return an array of references matching with an array of id.
*
* @param array $data
*
* @return array
*/
public function getResults(array $data);

/**
* This method return a reference matching with a ref id.
*
* @param $id
*
* @return array
*/
public function findById($id);

/**
* This method return a specific value for an id or null if not exist.
*
* @param $value
* @param $id
*
* @return mixed|null|string
*/
public function findValueForId($value, $id);

/**
* getChildren ids for a ref id.
*
* @param $id
*
* @return array
*/
public function getChildren($id);


/**
* Find a ref id for an url.
*
* @param string $url
* @param string $locale
*
* @return mixed|string
*/
public function findRefIdByUrl($url = '', $locale = 'fr');
}

0 comments on commit 04ee3ff

Please sign in to comment.