2020-11-05 16:21:38 +00:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
2020-11-18 21:54:20 +00:00
|
|
|
namespace Automattic\WooCommerce\Vendor\League\Container\ServiceProvider;
|
2020-11-05 16:21:38 +00:00
|
|
|
|
2020-11-18 21:54:20 +00:00
|
|
|
use Automattic\WooCommerce\Vendor\League\Container\ContainerAwareTrait;
|
2020-11-05 16:21:38 +00:00
|
|
|
|
|
|
|
abstract class AbstractServiceProvider implements ServiceProviderInterface
|
|
|
|
{
|
|
|
|
use ContainerAwareTrait;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $provides = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $identifier;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function provides(string $alias) : bool
|
|
|
|
{
|
|
|
|
return in_array($alias, $this->provides, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function setIdentifier(string $id) : ServiceProviderInterface
|
|
|
|
{
|
|
|
|
$this->identifier = $id;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getIdentifier() : string
|
|
|
|
{
|
|
|
|
return $this->identifier ?? get_class($this);
|
|
|
|
}
|
|
|
|
}
|