Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Camo Image Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WP Plugins
Camo Image Proxy
Merge requests
!4
WIP: Initial release
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
WIP: Initial release
develop
into
master
Overview
0
Commits
18
Pipelines
29
Changes
2
Merged
Erick Hitter
requested to merge
develop
into
master
6 years ago
Overview
0
Commits
18
Pipelines
29
Changes
2
Expand
Fixes
#1
0
0
Merge request reports
Viewing commit
ba58ff06
Prev
Next
Show latest version
2 files
+
48
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
ba58ff06
Trait for forthcoming singletons
· ba58ff06
Erick Hitter
authored
7 years ago
inc/trait-singleton.php
0 → 100644
+
40
−
0
Options
<?php
/**
* Trait file for Singletons.
*
* @package Camo_Image_Proxy
*/
namespace
Camo_Image_Proxy
;
/**
* Make a class into a singleton.
*/
trait
Singleton
{
/**
* Existing instance.
*
* @var object
*/
protected
static
$instance
;
/**
* Get class instance.
*
* @return object
*/
public
static
function
instance
()
{
if
(
!
isset
(
static
::
$instance
)
)
{
static
::
$instance
=
new
static
();
static
::
$instance
->
setup
();
}
return
static
::
$instance
;
}
/**
* Setup the singleton.
*/
public
function
setup
()
{
// Silence.
}
}
Loading