for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phossa Project
*
* PHP version 5.4
* @category Library
* @package Phossa2\Shared
* @copyright Copyright (c) 2016 phossa.com
* @license http://mit-license.org/ MIT License
* @link http://www.phossa.com/
*/
/*# declare(strict_types=1); */
namespace Phossa2\Shared\Shareable;
* Implementation of ShareableInterface
* @author Hong Zhang <[email protected]>
* @see ShareableInterface
* @version 2.0.10
* @since 2.0.10 added
trait ShareableTrait
{
* Shareables' pool
* @var ShareableInstance[]
* @access private
* @staticvar
private static $shareables = [];
* minimum constructor
* @access public
* @final
final public function __construct()
}
/*
* {@inheritDoc}
public static function getShareable(
/*# string */ $scope = '__GLOBAL__'
)/*# : ShareableInterface */ {
$class = get_called_class();
if (!isset(self::$shareables[$scope][$class])) {
self::$shareables[$scope][$class] = new static();
return self::$shareables[$class];
public function isShareable(
)/*# : bool */ {
return $this === static::getShareable($scope);