[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/ -> Factory.php (summary)

Joomla! Content Management System

Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 806 lines (26 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 18 functions

  getApplication()
  getConfig()
  getContainer()
  getSession()
  getLanguage()
  getDocument()
  getUser()
  getCache()
  getDbo()
  getMailer()
  getDate()
  createConfig()
  createContainer()
  createDbo()
  createMailer()
  createLanguage()
  createDocument()
  getStream()

Functions
Functions that are not part of a class:

getApplication()   X-Ref
Get the global application object. When the global application doesn't exist, an exception is thrown.

return: CMSApplicationInterface object

getConfig($file = null, $type = 'PHP', $namespace = '')   X-Ref
Get a configuration object

Returns the global {@link \JConfig} object, only creating it if it doesn't already exist.

param: string  $file       The path to the configuration file
param: string  $type       The type of the configuration file
param: string  $namespace  The namespace of the configuration file
return: Registry

getContainer()   X-Ref
Get a container object

Returns the global service container object, only creating it if it doesn't already exist.

This method is only suggested for use in code whose responsibility is to create new services
and needs to be able to resolve the dependencies, and should therefore only be used when the
container is not accessible by other means.  Valid uses of this method include:

- A static `getInstance()` method calling a factory service from the container,
see `Joomla\CMS\Toolbar\Toolbar::getInstance()` as an example
- An application front controller loading and executing the Joomla application class,
see the `cli/joomla.php` file as an example
- Retrieving optional constructor dependencies when not injected into a class during a transitional
period to retain backward compatibility, in this case a deprecation notice should also be emitted to
notify developers of changes needed in their code

This method is not suggested for use as a one-for-one replacement of static calls, such as
replacing calls to `Factory::getDbo()` with calls to `Factory::getContainer()->get('db')`, code
should be refactored to support dependency injection instead of making this change.

return: Container

getSession(array $options = array()   X-Ref
Get a session object.

Returns the global {@link Session} object, only creating it if it doesn't already exist.

param: array  $options  An array containing session options
return: Session object

getLanguage()   X-Ref
Get a language object.

Returns the global {@link Language} object, only creating it if it doesn't already exist.

return: Language object

getDocument()   X-Ref
Get a document object.

Returns the global {@link \Joomla\CMS\Document\Document} object, only creating it if it doesn't already exist.

return: Document object

getUser($id = null)   X-Ref
Get a user object.

Returns the global {@link User} object, only creating it if it doesn't already exist.

param: integer  $id  The user to load - Can be an integer or string - If string, it is converted to ID automatically.
return: User object

getCache($group = '', $handler = 'callback', $storage = null)   X-Ref
Get a cache object

Returns the global {@link CacheController} object

param: string  $group    The cache group name
param: string  $handler  The handler to use
param: string  $storage  The storage method
return: \Joomla\CMS\Cache\CacheController object

getDbo()   X-Ref
Get a database object.

Returns the global {@link DatabaseDriver} object, only creating it if it doesn't already exist.

return: DatabaseDriver

getMailer()   X-Ref
Get a mailer object.

Returns the global {@link Mail} object, only creating it if it doesn't already exist.

return: Mail object

getDate($time = 'now', $tzOffset = null)   X-Ref
Return the {@link Date} object

param: mixed  $time      The initial time for the Date object
param: mixed  $tzOffset  The timezone offset.
return: Date object

createConfig($file, $type = 'PHP', $namespace = '')   X-Ref
Create a configuration object

param: string  $file       The path to the configuration file.
param: string  $type       The type of the configuration file.
param: string  $namespace  The namespace of the configuration file.
return: Registry

createContainer()   X-Ref
Create a container object

return: Container

createDbo()   X-Ref
Create a database object

return: DatabaseDriver

createMailer()   X-Ref
Create a mailer object

return: Mail object

createLanguage()   X-Ref
Create a language object

return: Language object

createDocument()   X-Ref
Create a document object

return: Document object

getStream($usePrefix = true, $useNetwork = true, $userAgentSuffix = 'Joomla', $maskUserAgent = false)   X-Ref
Creates a new stream object with appropriate prefix

param: boolean  $usePrefix        Prefix the connections for writing
param: boolean  $useNetwork       Use network if available for writing; use false to disable (e.g. FTP, SCP)
param: string   $userAgentSuffix  String to append to user agent
param: boolean  $maskUserAgent    User agent masking (prefix Mozilla)
return: Stream



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer