<?php
namespace Wpupgrader\Libraries\WordPress\Plugins\Core\Factory;

use Wpupgrader\Libraries\WordPress\Plugins\Core\Factory;

class Blocks extends Factory
{
    public function getBlock($name)
    {
        $reflector = new \ReflectionClass($this->config); // class Foo of namespace A

        $controllerName = '\\'.$reflector->getNamespaceName().'\Blocks\\'.$name; // capitalize first letters of class name parts and add prefix

        return new $controllerName($this->config, $name);
    }
}