Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
Always use protected unless there is a good reason not to.
ws, phpdoc, proper variable/member/property naming.
  • Loading branch information
mrubinsk committed May 14, 2015
1 parent 9ad50e9 commit 21517b8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 76 deletions.
57 changes: 20 additions & 37 deletions framework/Kolab_Storage/lib/Horde/Kolab/Storage/Cache.php
Expand Up @@ -40,21 +40,14 @@ class Horde_Kolab_Storage_Cache
*
* @var Horde_Cache
*/
protected $horde_cache;

/**
* List cache instances.
*
* @var array
*/
private $_list_caches;
protected $_horde_cache;

/**
* Data cache instances.
*
* @var array
*/
private $_data_caches;
protected $_data_caches;

/**
* Constructor.
Expand All @@ -63,7 +56,7 @@ class Horde_Kolab_Storage_Cache
*/
public function __construct($cache)
{
$this->horde_cache = $cache;
$this->_horde_cache = $cache;
}

/**
Expand All @@ -89,26 +82,24 @@ public function getDataCache($data_params)
/**
* Retrieve data set.
*
* @param string $data_id ID of the data set.
* @param string $data_id ID of the data set.
*
* @return string The cached data set.
*/
public function loadData($data_id)
{
return $this->horde_cache->get($data_id, 0);
return $this->_horde_cache->get($data_id, 0);
}

/**
* Cache data set.
*
* @param string $data_id ID of the data set.
* @param string $data The data to be cached.
*
* @return NULL
* @param string $data_id ID of the data set.
* @param string $data The data to be cached.
*/
public function storeData($data_id, $data)
{
$this->horde_cache->set($data_id, $data, 0);
$this->_horde_cache->set($data_id, $data, 0);
}

/**
Expand All @@ -122,7 +113,7 @@ public function storeData($data_id, $data)
*/
public function loadAttachment($data_id, $obid, $attachment_id)
{
$data = $this->horde_cache->get(
$data = $this->_horde_cache->get(
$this->_getAttachmentId($data_id, $obid, $attachment_id),
0
);
Expand All @@ -134,16 +125,14 @@ public function loadAttachment($data_id, $obid, $attachment_id)
/**
* Store an attachment.
*
* @param string $data_id ID of the data set.
* @param string $obid Object backend id.
* @param string $attachment_id Attachment ID.
* @param resource $data A stream opened to the attachment data.
*
* @return NULL
* @param string $data_id ID of the data set.
* @param string $obid Object backend id.
* @param string $attachment_id Attachment ID.
* @param resource $data A stream opened to the attachment data.
*/
public function storeAttachment($data_id, $obid, $attachment_id, $data)
{
$this->horde_cache->set(
$this->_horde_cache->set(
$this->_getAttachmentId($data_id, $obid, $attachment_id),
(string)new Horde_Stream_Existing(array('stream' => $data)),
0
Expand All @@ -156,12 +145,10 @@ public function storeAttachment($data_id, $obid, $attachment_id, $data)
* @param string $data_id ID of the data set.
* @param string $obid Object backend id.
* @param string $attachment_id Attachment ID.
*
* @return NULL
*/
public function deleteAttachment($data_id, $obid, $attachment_id)
{
return $this->horde_cache->expire(
return $this->_horde_cache->expire(
$this->_getAttachmentId($data_id, $obid, $attachment_id)
);
}
Expand All @@ -175,20 +162,18 @@ public function deleteAttachment($data_id, $obid, $attachment_id)
*/
public function loadList($list_id)
{
return $this->horde_cache->get($list_id, 0);
return $this->_horde_cache->get($list_id, 0);
}

/**
* Cache list data.
*
* @param string $list_id ID of the connection matching the list.
* @param string $data The data to be cached.
*
* @return NULL
*/
public function storeList($list_id, $data)
{
$this->horde_cache->set($list_id, $data, 0);
$this->_horde_cache->set($list_id, $data, 0);
}

/**
Expand All @@ -211,9 +196,9 @@ private function _getDataId($data_params)
/**
* Compose the attachment key.
*
* @param string $data_id ID of the data set.
* @param string $obid Object backend id.
* @param string $attachment_id Attachment ID.
* @param string $data_id ID of the data set.
* @param string $obid Object backend id.
* @param string $attachment_id Attachment ID.
*
* @return string The attachment cache ID.
*/
Expand All @@ -227,8 +212,6 @@ private function _getAttachmentId($data_id, $obid, $attachment_id)
/**
* Determine if a necessary parameter is set.
*
* @return NULL
*
* @throws Horde_Kolab_Storage_Exception In case the parameter is missing.
*/
public function requireParameter($parameters, $type, $key)
Expand Down
27 changes: 10 additions & 17 deletions framework/Kolab_Storage/lib/Horde/Kolab/Storage/Data/Base.php
Expand Up @@ -31,42 +31,42 @@ class Horde_Kolab_Storage_Data_Base
*
* @var Horde_Kolab_Storage_Folder
*/
private $_folder;
protected $_folder;

/**
* The driver for accessing the Kolab storage system.
*
* @var Horde_Kolab_Storage_Driver
*/
private $_driver;
protected $_driver;

/**
* The factory for generating additional resources.
*
* @var Horde_Kolab_Storage_Factory
*/
private $_factory;
protected $_factory;

/**
* The folder type.
*
* @var string
*/
private $_type;
protected $_type;

/**
* The version of the data.
*
* @var int
*/
private $_version;
protected $_version;

/**
* The list of registered queries.
*
* @var array
*/
private $_queries = array();
protected $_queries = array();

/**
* Logger instance, or stub.
Expand Down Expand Up @@ -366,6 +366,7 @@ public function fetchPart($uid, $id)
* the parsed data.
*
* @return array An array of objects.
* @throws new Horde_Kolab_Storage_Exception
*/
public function fetch($uids, $raw = false)
{
Expand Down Expand Up @@ -404,6 +405,7 @@ public function fetch($uids, $raw = false)
* @param string $object_uid The object ID.
*
* @return string The backend ID for the object.
* @throws new Horde_Kolab_Storage_Exception
*/
public function getBackendId($object_id)
{
Expand Down Expand Up @@ -438,6 +440,7 @@ public function objectIdExists($object_id)
* @param string $object_id The object id.
*
* @return array The object data as an array.
* @throws new Horde_Kolab_Storage_Exception
*/
public function getObject($object_id)
{
Expand Down Expand Up @@ -578,8 +581,6 @@ public function getErrors()
*
* @param string $object_id ID of the message to be moved.
* @param string $new_folder Target folder.
*
* @return NULL
*/
public function move($object_id, $new_folder)
{
Expand Down Expand Up @@ -607,8 +608,6 @@ public function move($object_id, $new_folder)
* Delete the specified objects from this data set.
*
* @param array|string $object_ids Id(s) of the object to be deleted.
*
* @return NULL
*/
public function delete($object_ids)
{
Expand Down Expand Up @@ -639,8 +638,6 @@ public function delete($object_ids)

/**
* Delete all objects from this data set.
*
* @return NULL
*/
public function deleteAll()
{
Expand All @@ -651,8 +648,6 @@ public function deleteAll()
* Delete the specified messages from this folder.
*
* @param array|string $uids Backend id(s) of the message to be deleted.
*
* @return NULL
*/
public function deleteBackendIds($uids)
{
Expand All @@ -669,7 +664,7 @@ public function deleteBackendIds($uids)
* @param string $name The query name.
* @param Horde_Kolab_Storage_Query $query The query to register.
*
* @return NULL
* @throws new Horde_Kolab_Storage_Exception
*/
public function registerQuery($name, Horde_Kolab_Storage_Query $query)
{
Expand All @@ -685,8 +680,6 @@ public function registerQuery($name, Horde_Kolab_Storage_Query $query)
* Synchronize the data information with the information from the backend.
*
* @param array $params Additional parameters.
*
* @return NULL
*/
public function synchronize($params = array())
{
Expand Down

0 comments on commit 21517b8

Please sign in to comment.