public static function client($id = null, $byName = false)
	{
		// Only create the array if it does not exist
		if (self::$_clients === null)
		{
			self::$_clients = array();

			include_once __DIR__ . DIRECTORY_SEPARATOR . 'Client' . DIRECTORY_SEPARATOR . 'ClientInterface.php';

			$dirIterator = new \DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'Client');
			foreach ($dirIterator as $file)
			{
				if ($file->isDot() || $file->isDir())
				{
					continue;
				}

				$client = preg_replace('#\.[^.]*$#', '', $file->getFilename());
				if ($client == 'ClientInterface')
				{
					continue;
				}

				$cls = __NAMESPACE__ . '\\Client\\' . ucfirst(strtolower($client));

				if (!class_exists($cls))
				{
					include_once $file->getPathname();

					if (!class_exists($cls))
					{
						throw new \InvalidArgumentException(sprintf('Invalid client type of "%s".', $client));
					}
				}

				$obj = new $cls;

				self::$_clients[$obj->id] = $obj;
			}
			ksort(self::$_clients);
		}

		// If no client id has been passed return the whole array
		if (is_null($id))
		{
			return self::$_clients;
		}

		// Are we looking for client information by id or by name?
		if (!$byName)
		{
			if (isset(self::$_clients[$id]))
			{
				return self::$_clients[$id];
			}
		}
		else
		{
			foreach (self::$_clients as $client)
			{
				if ($client->name == strtolower($id))
				{
					return $client;
				}
			}
		}

		return null;
	}
public static function client($id = null, $byName = false)
	{
		// Only create the array if it does not exist
		if (self::$_clients === null)
		{
			self::$_clients = array();

			include_once __DIR__ . DIRECTORY_SEPARATOR . 'Client' . DIRECTORY_SEPARATOR . 'ClientInterface.php';

			$dirIterator = new \DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'Client');
			foreach ($dirIterator as $file)
			{
				if ($file->isDot() || $file->isDir())
				{
					continue;
				}

				$client = preg_replace('#\.[^.]*$#', '', $file->getFilename());
				if ($client == 'ClientInterface')
				{
					continue;
				}

				$cls = __NAMESPACE__ . '\\Client\\' . ucfirst(strtolower($client));

				if (!class_exists($cls))
				{
					include_once $file->getPathname();

					if (!class_exists($cls))
					{
						throw new \InvalidArgumentException(sprintf('Invalid client type of "%s".', $client));
					}
				}

				$obj = new $cls;

				self::$_clients[$obj->id] = $obj;
			}
			ksort(self::$_clients);
		}

		// If no client id has been passed return the whole array
		if (is_null($id))
		{
			return self::$_clients;
		}

		// Are we looking for client information by id or by name?
		if (!$byName)
		{
			if (isset(self::$_clients[$id]))
			{
				return self::$_clients[$id];
			}
		}
		else
		{
			foreach (self::$_clients as $client)
			{
				if ($client->name == strtolower($id))
				{
					return $client;
				}
			}
		}

		return null;
	}
public static function client ( $ id = null , $ byName = false ) { // Only create the array if it does not exist if ( self :: $ _clients === null ) { self :: $ _clients = array ( ) ; include_once __DIR__ . DIRECTORY_SEPARATOR . 'Client' . DIRECTORY_SEPARATOR . 'ClientInterface.php' ; $ dirIterator = new \ DirectoryIterator ( __DIR__ . DIRECTORY_SEPARATOR . 'Client' ) ; foreach ( $ dirIterator as $ file ) { if ( $ file -> isDot ( ) || $ file -> isDir ( ) ) { continue ; } $ client = preg_replace ( '#\.[^.]*$#' , '' , $ file -> getFilename ( ) ) ; if ( $ client == 'ClientInterface' ) { continue ; } $ cls = __NAMESPACE__ . '\\Client\\' . ucfirst ( strtolower ( $ client ) ) ; if ( ! class_exists ( $ cls ) ) { include_once $ file -> getPathname ( ) ; if ( ! class_exists ( $ cls ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid client type of "%s".' , $ client ) ) ; } } $ obj = new $ cls ; self :: $ _clients [ $ obj -> id ] = $ obj ; } ksort ( self :: $ _clients ) ; } // If no client id has been passed return the whole array if ( is_null ( $ id ) ) { return self :: $ _clients ; } // Are we looking for client information by id or by name? if ( ! $ byName ) { if ( isset ( self :: $ _clients [ $ id ] ) ) { return self :: $ _clients [ $ id ] ; } } else { foreach ( self :: $ _clients as $ client ) { if ( $ client -> name == strtolower ( $ id ) ) { return $ client ; } } } return null ; }
Gets information on a specific client id.  This method will be useful in
future versions when we start mapping applications in the database.

This method will return a client information array if called
with no arguments which can be used to add custom application information.

@param   integer  $id      A client identifier
@param   boolean  $byName  If True, find the client by its name
@return  mixed    Object describing the client or false if not known
Gets information on a specific client id . This method will be useful in future versions when we start mapping applications in the database .