kylekatarnls/sbp

View on GitHub
src/Sbp/Plugins/Core/DefinedFunction.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Sbp\Plugins\Core;

class DefinedFunction
{
    public static function compileDefinedFunctions($content, $caller)
    {
        return array(
            '#if-defined-(function\s+('.constant($caller.'::VALIDNAME').')([^\{]*)'.constant($caller.'::BRACES').')#',
            'if (! function_exists(\'$2\')) { $1 }',
        );
    }
}