for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Moka\Plugin;
use Moka\Exception\NotImplementedException;
/**
* Class PluginHelper
* @package Moka\Plugin
*/
final class PluginHelper
{
* Plugin FQCN has to match this template.
const PLUGIN_FQCN_TEMPLATE = 'Moka\\Plugin\\%s\\%sPlugin';
* @param string $pluginName
* @return string
*
* @throws NotImplementedException
public static function load(string $pluginName): string
$pluginFQCN = self::generateFQCN($pluginName);
if (
!class_exists($pluginFQCN) ||
!in_array(PluginInterface::class, class_implements($pluginFQCN), true)
) {
throw new NotImplementedException(
sprintf(
'Mocking strategy "%s" does not exist',
$pluginName
)
);
}
return $pluginFQCN;
private static function generateFQCN(string $pluginName): string
return sprintf(
self::PLUGIN_FQCN_TEMPLATE,
ucfirst($pluginName),
ucfirst($pluginName)