From 5b5c67c9ce65c3d7978ab8c29627b8383d7d8fb2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sat, 30 Jan 2010 11:44:15 -0700 Subject: [PATCH] Phpdoc fixes/cleanup. --- framework/Auth/lib/Horde/Auth/Cyrus.php | 7 - framework/Imap_Client/lib/Horde/Imap/Client.php | 2 +- .../Imap_Client/lib/Horde/Imap/Client/Cclient.php | 27 ++-- .../Imap_Client/lib/Horde/Imap/Client/Socket.php | 2 + framework/Injector/lib/Horde/Injector.php | 178 +++++++++++++-------- .../Memcache/scripts/Horde/Memcache/stats.php | 10 +- 6 files changed, 130 insertions(+), 96 deletions(-) diff --git a/framework/Auth/lib/Horde/Auth/Cyrus.php b/framework/Auth/lib/Horde/Auth/Cyrus.php index 8e505c690..37195bd0f 100644 --- a/framework/Auth/lib/Horde/Auth/Cyrus.php +++ b/framework/Auth/lib/Horde/Auth/Cyrus.php @@ -64,13 +64,6 @@ * 'password_field' => 'password' * ) * ); - * - * if (!function_exists('_horde_select_loginscreen')) { - * function _horde_select_loginscreen() - * { - * return 'imp'; - * } - * } * * * Copyright 2002-2010 The Horde Project (http://www.horde.org/) diff --git a/framework/Imap_Client/lib/Horde/Imap/Client.php b/framework/Imap_Client/lib/Horde/Imap/Client.php index 3efd71fc4..ac9c8b047 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client.php @@ -31,7 +31,6 @@ * + Horde_Imap_Client::FETCH_STRUCTURE * 'lifetime' - [OPTIONAL] (integer) The lifetime of the cache data (in secs). * 'slicesize' - [OPTIONAL] (integer) The slicesize to use. - * * comparator - (string) The search comparator to use instead of the default * IMAP server comparator. See setComparator() for the format. * DEFAULT: Use the server default @@ -58,6 +57,7 @@ * DEFAULT: False * timeout - (integer) Connection timeout, in seconds. * DEFAULT: 30 seconds + * * * Copyright 2008-2010 The Horde Project (http://www.horde.org/) * diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Cclient.php b/framework/Imap_Client/lib/Horde/Imap/Client/Cclient.php index 4307cef66..25cf4470e 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Cclient.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Cclient.php @@ -6,18 +6,21 @@ * PHP IMAP module: http://www.php.net/imap * * Optional Parameters: - * retries - (integer) Connection retries. - * DEFAULT: 3 - * timeout - (array) Timeout value (in seconds) for various actions. Unlinke - * the base Horde_Imap_Client class, this driver supports an - * array of timeout entries as follows: - * 'open', 'read', 'write', 'close' - * If timeout is a string, the same timeout will be used for all - * values. - * DEFAULT: C-client default values - * validate_cert - (boolean) If using tls or ssl connections, validate the - * certificate? - * DEFAULT: Don't validate + * -------------------- + *
+ * retries - (integer) Connection retries.
+ *           DEFAULT: 3
+ * timeout - (array) Timeout value (in seconds) for various actions. Unlinke
+ *           the base Horde_Imap_Client class, this driver supports an
+ *           array of timeout entries as follows:
+ *             'open', 'read', 'write', 'close'
+ *           If timeout is a string, the same timeout will be used for all
+ *           values.
+ *           DEFAULT: C-client default values
+ * validate_cert - (boolean)  If using tls or ssl connections, validate the
+ *                 certificate?
+ *                 DEFAULT: Don't validate
+ * 
* * Copyright 2008-2010 The Horde Project (http://www.horde.org/) * diff --git a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php index 35afa5531..cad32a9b7 100644 --- a/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php +++ b/framework/Imap_Client/lib/Horde/Imap/Client/Socket.php @@ -6,6 +6,7 @@ * Optional Parameters: NONE * * This driver implements the following IMAP-related RFCs: + *
  *   RFC 2086/4314 - ACL
  *   RFC 2087 - QUOTA
  *   RFC 2088 - LITERAL+
@@ -60,6 +61,7 @@
  *   RFC 5466 - FILTERS
  *
  *   draft-ietf-morg-inthread-00 - SEARCH=INTHREAD
+ * 
* * Originally based on code from: * + auth.php (1.49) diff --git a/framework/Injector/lib/Horde/Injector.php b/framework/Injector/lib/Horde/Injector.php index efaa1fe51..c37bd273d 100644 --- a/framework/Injector/lib/Horde/Injector.php +++ b/framework/Injector/lib/Horde/Injector.php @@ -2,75 +2,88 @@ /** * Injector class for injecting dependencies of objects * - * This class is responsible for injecting dependencies of objects. It is inspired - * by the bucket_Container's concept of child scopes, but written to support many different - * types of bindings as well as allowing for setter injection bindings. + * This class is responsible for injecting dependencies of objects. It is + * inspired by the bucket_Container's concept of child scopes, but written to + * support many different types of bindings as well as allowing for setter + * injection bindings. * + * @author Bob Mckee + * @author James Pepin * @category Horde - * @package Horde_Injector - * @author Bob Mckee - * @author James Pepin + * @package Horde_Injector */ class Horde_Injector implements Horde_Injector_Scope { private $_parentInjector; - private $_bindings; + private $_bindings = array(); private $_instances; /** - * create a new injector object. + * Create a new injector object. * - * Every injector object has a parent scope. For the very first Horde_Injector, you should pass it a - * Horde_Injector_TopLevel + * Every injector object has a parent scope. For the very first + * Horde_Injector, you should pass it a Horde_Injector_TopLevel object. * - * @param Horde_Injector_Scope The parent scope + * @param Horde_Injector_Scope $injector The parent scope. */ public function __construct(Horde_Injector_Scope $injector) { $this->_parentInjector = $injector; - $this->_bindings = array(); $this->_instances = array(__CLASS__ => $this); } /** - * create a child injector that inherits this injector's scope. + * Create a child injector that inherits this injector's scope. * - * All child injectors inherit the parent scope. Any objects that were created using - * getInstance, will be available to the child container. The child container can set bindings - * to override the parent, and none of those bindings will leak to the parent. + * All child injectors inherit the parent scope. Any objects that were + * created using getInstance, will be available to the child container. + * The child container can set bindings to override the parent, and none + * of those bindings will leak to the parent. * - * @return Horde_Injector A child injector with $this as its parent + * @return Horde_Injector A child injector with $this as its parent. */ public function createChildInjector() { return new self($this); } + /** + * TODO + * + * @param string $name TODO + * @param array $name TODO + * + * @return TODO + * @throws BadMethodCallException + */ public function __call($name, $args) { if (substr($name, 0, 4) == 'bind') { return $this->_bind(substr($name, 4), $args); } - throw new BadMethodCallException('Call to undefined method ' . __CLASS__ . - '::' . $name . '()'); + + throw new BadMethodCallException('Call to undefined method ' . __CLASS__ . '::' . $name . '()'); } /** - * method that creates binders to send to addBinder. This is called by the magic method __call - * whenever a function is called that starts with bind + * Method that creates binders to send to addBinder(). This is called by + * the magic method __call() whenever a function is called that starts + * with bind. * - * @param string $type The type of Horde_Injector_Binder_ to be created. Matches ^Horde_Injector_Binder_(\w+)$ - * @param array $args The constructor arguments for the binder object + * @param string $type The type of Horde_Injector_Binder_ to be created. + * Matches /^Horde_Injector_Binder_(\w+)$/. + * @param array $args The constructor arguments for the binder object. * - * @return Horde_Injector_Binder The binder object created. Useful for method chaining + * @return Horde_Injector_Binder The binder object created. Useful for + * method chaining. + * @throws BadMethodCallException */ private function _bind($type, $args) { $interface = array_shift($args); if (!$interface) { - throw new BadMethodCallException('First parameter for "bind' . $type . - '" must be the name of an interface or class'); + throw new BadMethodCallException('First parameter for "bind' . $type . '" must be the name of an interface or class'); } $reflectionClass = new ReflectionClass('Horde_Injector_Binder_' . $type); @@ -87,16 +100,23 @@ class Horde_Injector implements Horde_Injector_Scope /** * Add a Horde_Injector_Binder to an interface * - * This is the method by which we bind an interface to a concrete implentation, - * or factory. For convenience, binders may be added by bind[BinderType]. + * This is the method by which we bind an interface to a concrete + * implentation or factory. For convenience, binders may be added by + * bind[BinderType]. + * * bindFactory - creates a Horde_Injector_Binder_Factory * bindImplementation - creates a Horde_Injector_Binder_Implementation - * All subsequent arguments are passed to the constructor of the Horde_Injector_Binder object - * Any Horde_Injector_Binder_ Object may be created this way. * - * @param string $interface The interface to bind to - * @param Horde_Injector_Binder $binder The binder to be bound to the specified $interface - * @return Horde_Injector $this a reference to itself for method chaining + * All subsequent arguments are passed to the constructor of the + * Horde_Injector_Binder object. + * + * Any Horde_Injector_Binder object may be created this way. + * + * @param string $interface The interface to bind to. + * @param Horde_Injector_Binder $binder The binder to be bound to the + * specified $interface. + * + * @return Horde_Injector A reference to itself for method chaining. */ public function addBinder($interface, Horde_Injector_Binder $binder) { @@ -105,32 +125,57 @@ class Horde_Injector implements Horde_Injector_Scope } /** + * TODO + */ + private function _addBinder($interface, Horde_Injector_Binder $binder) + { + // first we check to see if our parent already has an equal binder set. + // if so we don't need to do anything + if (!$binder->equals($this->_parentInjector->getBinder($interface))) { + $this->_bindings[$interface] = $binder; + } + } + + /** * Get the Binder associated with the specified instance. * * Binders are objects responsible for binding a particular interface - * with a class. If no binding is set for this object, the parent scope is consulted. + * with a class. If no binding is set for this object, the parent scope is + * consulted. + * + * @param string $interface The interface to retrieve binding information + * for. * - * @param string $interface The interface to retrieve binding information for - * @return Horde_Injector_Binder The binding set for the specified interface + * @return Horde_Injector_Binder The binding set for the specified + * interface. */ public function getBinder($interface) { - if (isset($this->_bindings[$interface])) { - return $this->_bindings[$interface]; - } - return $this->_parentInjector->getBinder($interface); + return isset($this->_bindings[$interface]) + ? $this->_bindings[$interface] + : $this->_parentInjector->getBinder($interface); } /** - * Set the object instance to be retrieved by getInstance the next time the specified - * interface is requested. + * TODO + */ + private function _getBinder($interface) + { + return $this->_bindings[$interface]; + } + + /** + * Set the object instance to be retrieved by getInstance the next time + * the specified interface is requested. * - * This method allows you to set the cached object instance so that all subsequent getInstance - * calls return the object you have specified + * This method allows you to set the cached object instance so that all + * subsequent getInstance() calls return the object you have specified. * - * @param string $interface The interface to bind the instance to - * @param mixed $instance The object instance to be bound to the specified instance - * @return Horde_Injector $this a reference to itself for method chaining + * @param string $interface The interface to bind the instance to. + * @param mixed $instance The object instance to be bound to the + * specified instance. + * + * @return Horde_Injector A reference to itself for method chaining. */ public function setInstance($interface, $instance) { @@ -139,14 +184,16 @@ class Horde_Injector implements Horde_Injector_Scope } /** - * Create a new instance of the specified object/interface + * Create a new instance of the specified object/interface. * * This method creates a new instance of the specified object/interface. - * NOTE: it does not save that instance for later retrieval. If your object should - * be re-used elsewhere, you should be using getInstance + * NOTE: it does not save that instance for later retrieval. If your + * object should be re-used elsewhere, you should be using getInstance(). + * + * @param string $interface The interface name, or object class to be + * created. * - * @param string $interface The interface name, or object class to be created. - * @return mixed A new object that implements $interface + * @return mixed A new object that implements $interface. */ public function createInstance($interface) { @@ -156,14 +203,18 @@ class Horde_Injector implements Horde_Injector_Scope /** * Retrieve an instance of the specified object/interface. * - * This method gets you an instance, and saves a reference to that instance for later requests. + * This method gets you an instance, and saves a reference to that + * instance for later requests. * Interfaces must be bound to a concrete class to be created this way. * Concrete instances may be created through reflection. - * It does not gaurantee that it is a new instance of the object. For a new - * instance see createInstance + * It does not gaurantee that it is a new instance of the object. For a + * new instance see createInstance(). + * + * @param string $interface The interface name, or object class to be + * created. * - * @param string $interface The interface name, or object class to be created. - * @return mixed An object that implements $interface, not necessarily a new one. + * @return mixed An object that implements $interface, not necessarily a + * new one. */ public function getInstance($interface) { @@ -184,17 +235,4 @@ class Horde_Injector implements Horde_Injector_Scope return $this->_instances[$interface]; } - private function _addBinder($interface, Horde_Injector_Binder $binder) - { - // first we check to see if our parent already has an equal binder set. - // if so we don't need to do anything - if (!$binder->equals($this->_parentInjector->getBinder($interface))) { - $this->_bindings[$interface] = $binder; - } - } - - private function _getBinder($interface) - { - return $this->_bindings[$interface]; - } } diff --git a/framework/Memcache/scripts/Horde/Memcache/stats.php b/framework/Memcache/scripts/Horde/Memcache/stats.php index 57cdb7983..f408bd376 100755 --- a/framework/Memcache/scripts/Horde/Memcache/stats.php +++ b/framework/Memcache/scripts/Horde/Memcache/stats.php @@ -3,7 +3,7 @@ /** * This script outputs statistics on the current memcache pool. * - * Usage: memcache-stats.php [--all] [--raw] [--summary] [--lookup=key] + * Usage: stats.php [--all] [--flush] [--lookup=key] [--raw] [--summary] * * By default, shows statistics for all servers. * @@ -98,7 +98,7 @@ if ($all || $summary) { if ($all) { $cli->writeln($cli->green('Server: ' . $key . ' (Version: ' . $val['version'] . ' - ' . $val['threads'] . ' thread(s))')); - _outputInfo($val); + _outputInfo($val, $cli); if (--$i || $summary) { $cli->writeln(); } @@ -107,14 +107,12 @@ if ($all || $summary) { if ($summary) { $cli->writeln($cli->green('Memcache pool (' . $s_count . ' server(s))')); - _outputInfo($total); + _outputInfo($total, $cli); } } -function _outputInfo($val) +function _outputInfo($val, $cli) { - global $cli; - $cli->writeln($cli->indent('Size: ' . sprintf("%0.2f", $val['bytes'] / 1048576) . ' MB (Max: ' . sprintf("%0.2f", ($val['limit_maxbytes']) / 1048576) . ' MB - ' . ((!empty($val['limit_maxbytes']) ? round(($val['bytes'] / $val['limit_maxbytes']) * 100, 1) : 'N/A')) . '% used)')); $cli->writeln($cli->indent('Items: ' . $val['curr_items'] . ' (Total: ' . $val['total_items'] . ')')); $cli->writeln($cli->indent('Cache Ratio: ' . $val['get_hits'] . ' hits, ' . $val['get_misses'] . ' misses')); -- 2.11.0