call_user_func ve referans ile bu değişkenler

0 Cevap php

Orada Hy. Ben plug-in sistemi geliştiriyorum ve call_user_func ve başvurulan değişkenleri ile ilgili sorunlar var.

Ben bu gibi plug-in işleyicisi arıyorum:

    if(PluginFactory::NumberOfPlugins() != 0)
    foreach(PluginFactory::GetPlugins() as $pPlugin)
        call_user_func(get_class($pPlugin) . "::OnHandlePluggablePart", "Core:AfterSceneAssembly", $Document);

Nerede $Document Ben denetimleri tutmak benim belge nesnedir. Fikir eklentileri kontrol grubunu değiştirme (ekleme, silme, değiştirme) olabilir. Benim eklenti sınıf şudur:

class SomePlugin extends Plugin
{

    ...

    public static function OnHandlePluggablePart($sPart, &$Document)
    {
        if($sPart == "Core:AfterSceneAssembly")
        {
            $Document->AddControl(new Paragraph("", "Plugin test"));
        }
    }
}

Document object is passed by value (copied) not reference... What to do, what to do :) ?

0 Cevap