for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WPDFI\Traits;
/**
* Trait for single instance using in this plugin
*
* @author Duc Bui Quang <[email protected]>
* @since 1.0.0
*/
Trait Singleton
{
* Singleton instance of this class.
* @var \WPDFI\Traits\Singleton
protected static $instance = null;
* Constructor
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
protected function __construct() {
$this->initializes();
}
* Creates or returns an instance of this class.
* @return WPDFI\Traits\Singleton A single instance of this class.
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
return self::$instance;
* All Initialize actions come here
abstract public function initializes();
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.