/**
 * Constructor
 *
 * @param   string                   $name     The toolbar name.
 * @param   ToolbarFactoryInterface  $factory  The toolbar factory.
 *
 * @since   1.5
 */
public function __construct($name = 'toolbar', ToolbarFactoryInterface $factory = null)
{
    $this->_name = $name;
    // At 5.0, require the factory to be injected
    if (!$factory) {
        @trigger_error(sprintf('As of Joomla! 5.0, a %1$s must be provided to a %2$s object when creating it.', ToolbarFactoryInterface::class, \get_class($this)), E_USER_DEPRECATED);
        $factory = new ContainerAwareToolbarFactory();
        $factory->setContainer(Factory::getContainer());
    }
    $this->setFactory($factory);
    // Set base path to find buttons.
    $this->_buttonPath[] = __DIR__ . '/Button';
}