PHP Basics

Singleton

Allows just a single instance of the class using this trait.

Tags
author

Sebastian Meyer sebastian.meyer@opencultureconsulting.com

Table of Contents

Methods

getInstance()  : static
Get a singleton instance of this class.
__construct()  : void
This is a singleton class, thus the constructor is private.

Methods

getInstance()

Get a singleton instance of this class.

public final static getInstance(mixed ...$args) : static
APIYes
Parameters
$args : mixed

Constructor parameters

Return values
static

The singleton instance

__construct()

This is a singleton class, thus the constructor is private.

private abstract __construct() : void

Usage: Get an instance of this class by calling static::getInstance()


        
On this page

Search results