Cross platform objects transfer

I have created some package CopyMaker: https://github.com/igor1999/gi/tree/master/GI/Util/CopyMaker

This package able to create absolutely identical copy of any PHP variable.

Method CopyMaker::expand($source) gets some variable and creates either “scalar” - string, number, resource pointer… or “clean array”.

“Clean array” is tree, where any leaf is also scalar.

Method expand() replaces object with some specific array. Any member of this array equal object’s property and also there is an object’s meta information. E.g. class name or class alias.

Method CopyMaker::fold($contents) makes inversed action and creates copy of variable, that was expanded.

Important is that both method able to solve cyclic and double references…

class A
{
    private $b;

    private $c1;

    private $c2;

    public function __construct()
    {
         $this->b = new B($this); // cyclic reference

         $this->c1 = new C(); // double reference
         $this->c2 =  $this->c1;
    }
}

class B
{
    private $a;

    public function __construct(A $a)
    {
          $this->a = $a;
    }
}

class C
{

}

So, about my idea… “Clean array” format actually independent of platform. Single platform’ or even concrete application’ dependent detail is class name, but instead of name class aliass could be used.

That’s why I offer to all colleagues, that working with Java, C#, .NET, Python, Perl and so on… to create and save by Githab same packages as CopyMaker, but on their own favorite language. Then we’ll get “clean array” as universal transfer format.