for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the core-bundle package.
*
* (c) 2018 WEBEWEB
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WBW\Bundle\CoreBundle\Manager;
use WBW\Bundle\CoreBundle\Provider\ProviderInterface;
* Abstract manager.
* @author webeweb <https://github.com/webeweb/>
* @package WBW\Bundle\CoreBundle\Manager
* @abstract
abstract class AbstractManager implements ManagerInterface {
* Providers.
* @var ProviderInterface[]
private $providers;
* Constructor.
protected function __construct() {
$this->setProviders([]);
}
* Add a provider.
* @param ProviderInterface $provider The provider.
* @return ManagerInterface Returns this manager.
public function addProvider(ProviderInterface $provider) {
$this->providers[] = $provider;
return $this;
* Get the providers.
* @return ProviderInterface[] Returns the provider.
public function &getProviders() {
return $this->providers;
* {@inheritdoc}
public function hasProviders() {
return 0 < count($this->providers);
public function registerProvider(ProviderInterface $provider) {
return $this->addProvider($provider);
* Set the providers.
* @param ProviderInterface $providers The providers.
protected function setProviders(array $providers) {
$this->providers = $providers;
public function size() {
return count($this->providers);